当前位置: 首页 > 知识库问答 >
问题:

psycopg2无法安装在Mojave-macOS-10.14的virtualenv 2.7中。5.

索瀚海
2023-03-14

我有一个错误:

 cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110003 -DHAVE_LO64=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/11.3/include -I/usr/local/Cellar/postgresql/11.3/include/server -c psycopg/typecast.c -o build/temp.macosx-10.14-intel-2.7/psycopg/typecast.o
    cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/psycopg/psycopgmodule.o build/temp.macosx-10.14-intel-2.7/psycopg/green.o build/temp.macosx-10.14-intel-2.7/psycopg/pqpath.o build/temp.macosx-10.14-intel-2.7/psycopg/utils.o build/temp.macosx-10.14-intel-2.7/psycopg/bytes_format.o build/temp.macosx-10.14-intel-2.7/psycopg/libpq_support.o build/temp.macosx-10.14-intel-2.7/psycopg/win32_support.o build/temp.macosx-10.14-intel-2.7/psycopg/solaris_support.o build/temp.macosx-10.14-intel-2.7/psycopg/connection_int.o build/temp.macosx-10.14-intel-2.7/psycopg/connection_type.o build/temp.macosx-10.14-intel-2.7/psycopg/cursor_int.o build/temp.macosx-10.14-intel-2.7/psycopg/cursor_type.o build/temp.macosx-10.14-intel-2.7/psycopg/column_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_connection_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_cursor_type.o build/temp.macosx-10.14-intel-2.7/psycopg/replication_message_type.o build/temp.macosx-10.14-intel-2.7/psycopg/diagnostics_type.o build/temp.macosx-10.14-intel-2.7/psycopg/error_type.o build/temp.macosx-10.14-intel-2.7/psycopg/conninfo_type.o build/temp.macosx-10.14-intel-2.7/psycopg/lobject_int.o build/temp.macosx-10.14-intel-2.7/psycopg/lobject_type.o build/temp.macosx-10.14-intel-2.7/psycopg/notify_type.o build/temp.macosx-10.14-intel-2.7/psycopg/xid_type.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_asis.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_binary.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_datetime.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_list.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pboolean.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pdecimal.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pint.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_pfloat.o build/temp.macosx-10.14-intel-2.7/psycopg/adapter_qstring.o build/temp.macosx-10.14-intel-2.7/psycopg/microprotocols.o build/temp.macosx-10.14-intel-2.7/psycopg/microprotocols_proto.o build/temp.macosx-10.14-intel-2.7/psycopg/typecast.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/psycopg2/_psycopg.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'cc' failed with exit status 1
    ----------------------------------------
ERROR: Command "[path]/venv/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-install-nVe8Y3/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/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-record-NVUuR_/install-record.txt --single-version-externally-managed --compile --install-headers /[path]/venv/include/site/python2.7/psycopg2" failed with error code 1 in /private/var/folders/8n/zd44l25535b8kfhz1cfdx7980000gn/T/pip-install-nVe8Y3/psycopg2/

当我在macOS而不是virtualenv中安装psycopg2时,这对我很有帮助:psycopg2

回答@zganger

但是,当我在Virtualenv2.7(venv)中时,什么都不起作用,甚至在那篇文章中也没有答案。我花了一周时间试图解决这个问题,但一点运气都没有。

我不知道我还能做什么。

1. pip install django-toolbelt
2. pip install psycopg2

共有1个答案

鲁英卫
2023-03-14

所以,我已经尽了我所能,我发现我的莫哈韦版本是

10.14.5

这是到2019年7月14日为止的最新版本,但它不起作用。

我已经更新到最新版本了

10.14.6 and Command Line Tools 10.3

它于今天(2019年7月15日)发布,运行完美。

可能是以前的命令行工具或10.14.5版本的Mojave存在问题

 类似资料: