Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 pip安装psycopg2==2.6给出错误命令;python setup.py egg“u info”;失败,错误代码为1,位于/tmp/pip-build-f6rRmm/psycopg2中/_Python 2.7_Installation_Pip_Psycopg2_Postgresql 9.1 - Fatal编程技术网

Python 2.7 pip安装psycopg2==2.6给出错误命令;python setup.py egg“u info”;失败,错误代码为1,位于/tmp/pip-build-f6rRmm/psycopg2中/

Python 2.7 pip安装psycopg2==2.6给出错误命令;python setup.py egg“u info”;失败,错误代码为1,位于/tmp/pip-build-f6rRmm/psycopg2中/,python-2.7,installation,pip,psycopg2,postgresql-9.1,Python 2.7,Installation,Pip,Psycopg2,Postgresql 9.1,我的项目正在运行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

我的项目正在运行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'.

    ----------------------------------------
我完成了上面写的所有步骤

另外,在中的一些回答中,我看到我需要添加
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.

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

我认为您遇到了版本锁定的问题。您已锁定到版本
2.6
,该版本存在一些已知的生成问题,这些问题将在以后的版本中解决

如果您阅读此处的发行说明:您将看到版本
2.7
2.7.4
都修复了与构建和安装软件包有关的错误

我猜您以前安装的Linux运行的是较旧版本的Postgres(
9.5
,我想)。但是,现在升级了操作系统,您无意中升级到了版本
10

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

  • 确保正确配置PostgreSQL安装,以便可以从终端运行
    pg_config
  • 使用
    pip install psycopg2
  • 版本将您的
    libpq-dev
    包锁定到适合PostgreSQL
    9.5
  • 如果不需要版本
    10