我在OSX中安装psycopg2有很大的困难。使用homebrew安装Postgresql 9.5.4_1之后,我尝试在虚拟环境中安装psycopg2:pip install psycopg2
我还使用pg_config将PATH=$PATH:/usr/local/Cellar/postgresql/9.5.4_1/bin/pg_config
添加到路径中。
在此,我收到一些错误,包括:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
和
Failed building wheel for psycopg2
和
Command "/Users/*username*/.virtualenvs/report/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9p/3_wdgjzd03d6bw1p_c9rrt6c0000gp/T/pip-build-cuplxne2/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9p/3_wdgjzd03d6bw1p_c9rrt6c0000gp/T/pip-8gbk007q-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/*username*/.virtualenvs/report/bin/../include/site/python3.5/psycopg2" failed with error code 1 in /private/var/folders/9p/3_wdgjzd03d6bw1p_c9rrt6c0000gp/T/pip-build-cuplxne2/psycopg2/
试图从源构建会导致类似的错误..。
以前的研究和尝试的解决方案:
"Failed building wheel for psycopg2" - MacOSX using virtualenv and pip
How to install Psycopg2 for Python 3.5
How to install psycopg2 with "pip" on Python?
Installing psycopg2 into virtualenv when PostgreSQL is not installed on development system
Can't install psycopg2 with pip in virtualenv on Mac OS X 10.7
感谢您能提供的任何帮助!
发布于 2016-11-02 10:51:43
这似乎是一个问题,与Homebrew的更新OSX塞拉利昂。我终于通过卸载并重新安装python3.5和postgresql,用自制的修复了这个问题,然后再次尝试安装psycopg2。
发布于 2016-11-01 10:53:44
我去macosx sierra的路
全局安装psycopg2,然后在虚拟环境中使用它
pip3 install psycopg2
workon my_env #i use virtualenvwrapper
toggleglobalsitepackages #Enable global site-packages
在我的例子中,psycopg2通常作为全局包安装,但没有安装在虚拟环境中
发布于 2016-12-28 13:11:34
我的车与塞拉10.12.2的最新消息断绝了。重新安装/更新命令行工具,并正确安装psycopg2。
xcode-选择--安装
https://stackoverflow.com/questions/40352661
复制