2014-08-30 95 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