在 mac 上安装 psycopg2 时出错

Error when install psycopg2 on mac

当我尝试使用 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 谁能提出任何解决方案?

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

因此,您要么需要安装早期版本的 postgres,要么将您尝试安装的软件包移植到 psycopg2 2。7.x

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