我正在尝试安装psycopg2以便将django数据库与postgresql连接。我试过命令:
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
答案 0 :(得分:1)
我不确定您使用apt-get build-dep
而不是apt-get install
的原因。以下命令应该足以将Django与PostgreSQL一起使用。
sudo apt-get install libpq-dev
然后在虚拟环境中使用apt-get或pip安装psycopg2。