我正在尝试在我的Django项目中安装psycopg2。它给我这个错误。我已经安装了(psycopg2二进制,pillow和其他包这些都工作正常)。我刚刚重新安装了我的macOS & Xcode。我正在使用python 3.8.3 & Django 3.0.5和Homebrew 2.4.5和我的PostgreSQL 12.3
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command:
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c
'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-install-zr_qlm_k/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-install-zr_qlm_k/psycopg2/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
install --record
/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-record-rc16k7t9/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/psycopg2
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
---------------------------------------- ERROR: Command errored out with exit status 1:
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c
'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-install-zr_qlm_k/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-install-zr_qlm_k/psycopg2/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
install --record
/private/var/folders/hj/q_49d8351l11gj135qs6c01r0000gn/T/pip-record-rc16k7t9/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/psycopg2
Check the logs for full command output.
2条答案
按热度按时间ulmd4ohb1#
相反,使用psycopg 2-binary可以完美安装。
pip install psycopg2-binary
but5z9lq2#
我在我的Mac M1上也遇到了同样的问题,我用
brew install postgresql
安装后
pip3 install psycopg2
而且它工作正常