psycopg2无法在Mojave的virtualenv 2.7中安装-macOS-10.14.5

时间:2019-06-24 18:43:51

标签: django python-2.7 pip virtualenv psycopg2

我遇到此错误:

loc_ref.append(from_loc + [user_says])

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

@zganger的答案

但是当我使用virtualenv 2.7(venv)时-没有任何效果,即使在该帖子中也没有任何答案。我试图解决这个问题一周了,根本没有运气。

不确定我还能做什么。

创建virtualenv并仅运行这些命令时,两者都无法在psycopg2上运行,如果我安装了任何其他软件包,则除了psycopg2以外,其他所有功能都可以正常工作。

 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/

1 个答案:

答案 0 :(得分:0)

所以,我尽了一切努力,发现我的Mojave版本是

10.14.5

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

我已更新到最新版本

10.14.6 and Command Line Tools 10.3

已于今天(2019年7月15日)发布,并且运行良好。

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

此更新有效: Command Line Tools 10.3 / Mojave 10.14.d