pip install psycopg2 == 2.6给出错误命令“ python setup.py egg_info”失败,错误代码为/ tmp / pip-build-f6rRmm / psycopg2 /

蜀都

我的项目正在运行postgreSQL,将系统升级到ubuntu 16.04,然后再次克隆项目后,我无法安装特定的软件包。

我也曾尝试清除postgresql和psycopg2,但无法安装

(temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ pip install psycopg2==2.6 > ERROR.txt
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-f6rRmm/psycopg2/
(temp) hellrazor@hellrazor-desktop:~/workspace/te___ave/backend/te___ave$ 

这是我得到的错误

Collecting psycopg2==2.6
  Using cached psycopg2-2.6.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: pg_config executable not found.

    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.

    ----------------------------------------

我完成了https://help.ubuntu.com/community/PostgreSQL#Client_Installation中编写的所有步骤

另外在找不到pg_config可执行文件的一些答案中,我看到我需要添加sudo apt-get install libpq-dev python-dev

但是它给出了这个输出

(temp) hellrazor@hellrazor-desktop:~/workspace/teamwave/backend/teamwave$ sudo apt-get install libpq-dev python-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-dev is already the newest version (2.7.11-1).
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: libpq5 (= 9.5.10-0ubuntu0.16.04) but 10.1-1.pgdg16.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.

我正在尝试找到解决错误的方法,但现在没有任何线索。

大卫之家

我认为您遇到了版本锁定的问题psycopg2您已锁定到version 2.6,它具有一些已知的构建问题,这些问题将在更高版本中得到解决。

如果您阅读发行说明(位于此处):http : //initd.org/psycopg/docs/news.html#what-s-new-in-psycopg-2-7-4,您将看到该版本,2.7并且2.7.4都修复了错误关于构建和安装软件包。

我的猜测是您以前的Linux安装运行的是Postgres的旧版本(9.5我认为)。但是,既然您已经升级了操作系统,则无意中将其升级到了version 10

您可以尝试以下四种不同的解决方案,但首先您可能需要

  1. 确保已正确配置PostgreSQL安装,以便pg_config可以从终端运行。
  2. 使用以下命令删除pip安装中的版本锁定 pip install psycopg2
  3. 版本将您的libpq-dev软件包锁定为适合PostgreSQL的版本9.5
  4. 9.5如果不需要版本,请重新安装PostgreSQL至版本10

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章