【问题标题】:Ubuntu, fatal error: Python.h: No such file or directory #include <Python.h>Ubuntu,致命错误:Python.h:没有这样的文件或目录#include <Python.h>
【发布时间】:2021-02-26 00:13:48
【问题描述】:

当我尝试安装 psycopg2 时出现错误

致命错误:Python.h:没有这样的文件或目录 #include

因为,沿着路径/usr/include/python3.8搜索这个文件

但是这个文件位于路径/usr/local/include/python3.8/Python.x

这个问题怎么解决?? Python 是否安装在错误的目录中?

【问题讨论】:

    标签: python ubuntu


    【解决方案1】:

    不清楚您使用的是哪个版本的 Ubuntu。假设它是全新安装并且您没有安装这些。我建议你安装以下

    sudo apt-get install python3 python-dev python3-dev build-essential

    一旦安装了这些,然后再次尝试安装psycopg2

    【讨论】:

    • 我有,问题不在它,我指出Python.h在那里,但是psycopg2在不同的目录中寻找它。版本 18.04
    • 你使用的是虚拟环境吗?
    • 是的,我确实使用它
    猜你喜欢
    • 2021-09-19
    相关资源
    最近更新 更多