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



当我尝试安装psycopg2时,错误显示

fatal error: Python.h: No such file or directory
#include <Python.h>

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

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

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

目前还不清楚您使用的是什么版本的Ubuntu。假设这是一个新安装,而你没有安装这些。我建议你安装以下

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

安装后,请再次尝试安装psycopg2

最新更新