0

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

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.

现在我无法检测和纠正损坏的包裹......请帮助我......

4

2 回答 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
于 2017-01-17T12:27:42.307 回答
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

我通过上述步骤解决了问题

于 2017-12-18T17:43:29.957 回答