我已经连续几天搜索web时间了,我无法在我的Linux机器上安装psycopg2库(CentOS -2.6.32-431.1.el6.x86_64 GNU/Linux)。
我知道问题在于我丢失了libpq头文件,因为我在尝试pip安装psycopg2:libpq-fe.h: No such file or directory
之后收到了这条消息。
http://initd.org/psycopg/docs/install.html#install-from-source
我发现的几乎所有文章都指向我在CentOS上使用apt-get,但是apt-get不是CentOS 6.3上的标准工具,所以我一直在尝试yum install
。
然而,每次我尝试使用sudo yum install
下载一些东西,这个包是不可用的。例如:
yum install postgresql-devel Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile drivesrvr | 2.2 kB 00:00 No package postgresql-devel available. Error: Nothing to do
我试过这样做:
有什么想法吗?没有libpq头文件,我就无法安装psycopg2程序所必需的模块。这是用于Python2.7.12的。和PostgreSQL 9.3.13。
发布于 2016-12-07 21:57:31
我在亚马逊的Fedora 2016.09盒上有过这个问题。我能够通过yum安装postgresql-devel,但这并没有起作用;版本似乎过时了。
我用以下方法解决了它:
sudo yum install /usr/include/libpq-fe.h
这将安装postgresql的更新版本,该版本允许psycopg2在通过pip安装时正确编译。
https://stackoverflow.com/questions/39047523
复制相似问题