此问题与之前的问题类似,但无法使用相同的建议来解决。
我正在使用 Centos 7。在运行 Python 3.5(最新稳定版本)的虚拟环境中,我尝试安装psycopg2通过使用 pip3/pip/easy_install。
在所有情况下,我都会收到以下错误:
致命错误:Python.h:没有这样的文件或目录
我读过以前的帖子:
psycopg: Python.h: 没有这样的文件或目录 https://stackoverflow.com/questions/19843945/psycopg-python-h-no-such-file-or-directory
致命错误:Python.h:没有这样的文件或目录 https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory
但解决方案不起作用。任何想法?
如果您从源安装,则应满足几个系统依赖项:
http://initd.org/psycopg/docs/install.html#install-from-source http://initd.org/psycopg/docs/install.html#install-from-source
但 Python.h 肯定来自 python-devel (和 python3X-devel)包,因此如果没有找到它,则您的系统上可能存在某些配置错误。https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
或者,您可以使用包管理器来使用系统包,以便它为您解决依赖关系。
yum install python35-psycopg2 # python-psycopg2 for python 2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)