安装psycopg2后在ubuntu 14.04中安装libpq-dev时出错

问题描述 投票:0回答:2

我正在尝试安装项目的所有要求,所以我运行命令

pip install -r requirements.txt

但它给出了错误

Downloading/unpacking psycopg2==2.6 (from -r requirements.txt (line 58))
  Downloading psycopg2-2.6.tar.gz (367kB): 367kB downloaded
  Running setup.py (path:/tmp/pip_build_root/psycopg2/setup.py) egg_info for package psycopg2

    Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
    Complete output from command python setup.py egg_info:
    running egg_info

creating pip-egg-info/psycopg2.egg-info

writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/psycopg2
Storing debug log for failure in /home/admin/.pip/pip.log

现在我知道我必须安装postgresql-server所以我使用了以下命令

sudo apt-get install postgresql

好到现在然后我跑了

sudo apt-get install python-psycopg2

然后我运行我的命令再次安装要求,但得到相同的错误,然后我搜索谷歌并尝试

sudo apt-get install libpq-dev

但我得到了以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpq-dev : Depends: krb5-multidev but it is not going to be installed
             Depends: comerr-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

现在我无法检测并纠正破损的包裹......请帮帮我...

postgresql python-2.7 psycopg2 libpq libpqxx
2个回答
0
投票

我运行以下命令来修复损坏的包,然后我成功安装了Psycopg2和Postgresql ...

sudo apt-get update
sudo apt-get install python-dev
sudo apt-get install libpq-dev
sudo apt-get install krb5-multidev
sudo apt-get install libssl1.0.0=1.0.1f-1ubuntu2 ibcomerr2=1.42.9-3ubuntu1
sudo apt-get install libssl1.0.0=1.0.1f-1ubuntu2
sudo apt-get install ibcomerr2=1.42.9-3ubuntu1
sudo apt-get update
sudo apt-get install libpq-dev
apt-get install libssl-dev krb5-multidev comerr-dev
sudo apt-get install libssl-dev krb5-multidev comerr-dev
sudo apt-get dist-upgrade

sudo apt-get update
sudo apt-get install libssl-dev krb5-multidev comerr-dev
sudo apt-get install libcomerr2
sudo apt-get install comerr-dev
sudo apt-get install libcomerr2
sudo apt-get install comerr-dev
sudo apt-get install comerr-dev
sudo apt-get install 1.42.9-3ubuntu1.3
sudo apt-get install ibcomerr2=1.42.9-3ubuntu1
sudo apt-get install git
git clone https://github.com/kos0/addRemoveDistribution.git
cd addRemoveDistribution
sudo ./enableDisableDistribution.pl enable security
sudo ./enableDisableDistribution.pl enable updates
sudo apt-get update
sudo apt-get install libpq-dev
sudo apt-get update
pip install -r requirements.txt

0
投票

只需按照步骤操作

sudo apt-get install git
git clone https://github.com/kos0/addRemoveDistribution.git
cd addRemoveDistribution
sudo ./enableDisableDistribution.pl enable security
sudo ./enableDisableDistribution.pl enable updates
sudo apt-get update
sudo apt-get install libpq-dev
sudo apt-get update

我修正了上述步骤的问题

© www.soinside.com 2019 - 2024. All rights reserved.