在mac上安装psycopg2时出错

时间:2017-12-21 04:38:12

标签: django macos python-3.4

当我尝试使用pip install -r requirements.txt在mac上安装psycopg2时 我收到了错误。

Collecting psycopg2==2.6 (from -r requirements.txt (line 30))
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 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'
Error: could not determine PostgreSQL version from '10.1'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r6/0rwq93rx6n59lbn8jrng11gm0000gn/T/pip-build-hat1f3jy/psycopg2/

我无法解决。python3.4.3 mac10.12 有人可以建议任何解决方案吗?

1 个答案:

答案 0 :(得分:0)

您遇到的问题是psycopg2与Postgres 10不兼容,除非您使用2.7或更高版本。

因此,您需要安装较早版本的postgres或将您尝试安装的软件包安装到psycopg2 2.7.x

可以在此处找到2.7版中已解决的相关问题 https://github.com/psycopg/psycopg2/issues/489