2014-08-30 96 views
1

我想安装psycopg2以便将django数据库连接到postgresql。我试着命令:psycopg2的构建依赖不能满足

sudo apt-get build-dep psycopg2 

但它抛出错误

Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
The following packages have unmet dependencies: 
libpq-dev : Depends: libkrb5-dev but it is not going to be installed 
     Depends: comerr-dev but it is not going to be installed 
python-all-dbg : Depends: python (= 2.7.3-0ubuntu2.2) but 2.7.3-0ubuntu7.1 is to be installed 
       Depends: python-all (= 2.7.3-0ubuntu2.2) but it is not going to be installed 
       Depends: python-dbg (= 2.7.3-0ubuntu2.2) but it is not going to be installed 
python-all-dev : Depends: python (= 2.7.3-0ubuntu2.2) but 2.7.3-0ubuntu7.1 is to be installed 
       Depends: python-all (= 2.7.3-0ubuntu2.2) but it is not going to be installed 
       Depends: python-dev (= 2.7.3-0ubuntu2.2) but 2.7.3-0ubuntu7.1 is to be installed 
python3-all-dbg : Depends: python3 (= 3.2.3-0ubuntu1.2) but 3.2.3-5ubuntu1.2 is to be installed 
       Depends: python3-all (= 3.2.3-0ubuntu1.2) but it is not going to be installed 
       Depends: python3-dbg (= 3.2.3-0ubuntu1.2) but it is not going to be installed 
       Depends: python3.2-dbg but it is not going to be installed 
python3-all-dev : Depends: python3 (= 3.2.3-0ubuntu1.2) but 3.2.3-5ubuntu1.2 is to be installed 
       Depends: python3-all (= 3.2.3-0ubuntu1.2) but it is not going to be installed 
       Depends: python3-dev (= 3.2.3-0ubuntu1.2) but 3.2.3-5ubuntu1.2 is to be installed 
E: Build-dependencies for psycopg2 could not be satisfied. 

虽然满足以下要求来我已经安装了以下

Python 2.7 
Python 3.4 
PostgreSQL versions 9.1 

回答

1

我不知道为什么你正在使用apt-get build-dep而不是apt-get install。下面的命令应该足以使用Django和PostgreSQL。

sudo apt-get install libpq-dev 

然后在您的虚拟环境中使用apt-get或pip安装psycopg2。

+0

yum在RPM land中安装postgresql-libs – 2017-05-24 22:03:57