问题描述
我需要将 PostgreSQL 从 9.5 版升级到 11 版.之后,当我从requirements.txt"文件重新创建我的 virtualEnv 时,我在安装 psycopg2 包时开始出现以下错误:
I needed to upgrade PostgreSQL from version 9.5 to version 11. After that, when I recreated my virtualEnv from a 'requirements.txt' file, I started giving the following error when installing the psycopg2 package:
Collecting psycopg2 == 2.6.2 (from -r conf/requirements.txt (line 50))
Using cached https://files.pythonhosted.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.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: could not determine PostgreSQL version from '11 .1 '
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0Q7bhV/psycopg2/
推荐答案
经过一番研究,我运行了以下命令试图解决,但没有解决:
After some research, I ran the following commands to try to solve, but it did not work:
sudo apt-get install postgresql-server-dev-all
sudo apt-get install postgresql-common
最后,我注意到 psycopg2 的 2.6.2 版只支持 postgresql 的 9.5 版.对于 11,您应该使用最新版本的 psycopg2,即 2.7.7 版.更改requirements.txt文件后,virtualEnv已正确重新创建.
Finally, I noticed that version 2.6.2 of psycopg2 only supports version 9.5 of postgresql. For 11 you should use the latest version of psycopg2, that is, version 2.7.7. After you change the requirements.txt file, and the virtualEnv has been recreated correctly.
我希望它对其他人有用.
I hope it will be useful to others.
这篇关于命令“python setup.py egg_info"在 PATH/psycopg2 中失败,错误代码为 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!