我一直在网上搜索几天,我无法在我的Linux机器上安装psycopg2库(CentOS - 2.6.32-431.3.1.el6.x86_64 GNU / Linux)。
我知道问题是我错过了libpq头文件,因为我在尝试pip install 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头文件,我无法安装我的Python程序所必需的psycopg2模块。这适用于Python 2.7.12。和PostgreSQL 9.3.13。
答案 0 :(得分:3)
我在亚马逊上的Fedora 2016.09框上遇到了这个问题。我能够通过yum安装postgresql-devel,但这并不能解决问题;版本似乎已经过时了。
我用以下方法解决了它:
sudo yum install /usr/include/libpq-fe.h
这将安装postgresql-devel的更新版本,允许psycopg2在通过pip安装时正确编译。