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

在macos 10.15上安装psycopg2 python 3.7时出错

闾丘鸣
2023-03-14
Collecting psycopg2==2.7.3.1   Using cached https://files.pythonhosted.org/packages/6b/fb/15c687eda2f925f0ff59373063fdb408471b4284714a7761daaa65c01f15/psycopg2-2.7.3.1.tar.gz Installing collected packages: psycopg2
    Running setup.py install for psycopg2: started
    Running setup.py install for psycopg2: finished with status 'error'

    ERROR: Command errored out with exit status 1:
     command: /Users/amolchakane/Desktop/Projects/kisanoauth/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/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/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pip-record-f050z4mz/install-record.txt
--single-version-externally-managed --compile --install-headers /Users/amolchakane/Desktop/Projects/kisanoauth/venv/include/site/python3.7/psycopg2
         cwd: /private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/
    Complete output (61 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/psycopg1.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    creating build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_with.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_module.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_async.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_dates.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_async_keyword.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/testutils.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_connection.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_copy.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_fast_executemany.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_green.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_quote.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/testconfig.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_replication.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/test_notify.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2/tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/psycopg
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7.3.1 (dt dec pq3 ext lo64)" -DPG_VERSION_NUM=110500 -DHAVE_LO64=1
-I/Users/amolchakane/Desktop/Projects/kisanoauth/venv/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I. -I/usr/local/Cellar/postgresql/11.5_1/include -I/usr/local/Cellar/postgresql/11.5_1/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/amolchakane/Desktop/Projects/kisanoauth/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/psycopg2/setup.py'"'"';
__file__='"'"'/private/var/folders/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pycharm-packaging/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/c7/wshj0hq9637_ddn00y_52y7c0000gp/T/pip-record-f050z4mz/install-record.txt
--single-version-externally-managed --compile --install-headers /Users/amolchakane/Desktop/Projects/kisanoauth/venv/include/site/python3.7/psycopg2 Check the logs for full command output.

共有1个答案

邵飞鸿
2023-03-14

我可以通过安装上面注释中指出的二进制库来解决这个问题。(它只是有一个打字错误)

pip install psycopg2-binary

Amol Chakane的错误指的是PIP错误,指的是由于拼写错误而找不到的包。

还要确保pip命令引用的是正确的Python版本。在我的例子中,我使用的是带有Python 3的环境,我不需要指定pip3,而只需要指定pip

 类似资料:
  • 当我尝试在ubuntu上安装Yeoman时,我得到了以下错误。 编辑 尝试MortezaLSC的解决方案后-我得到以下错误

  • HTTP请求已发送,正在等待响应...404找不到2018-07-18 14:49:48错误404:找不到。

  • 问题内容: 我一直在尝试在Catalina的Mac上安装PyGame,但不知道该如何做。我得到的错误消息是:SystemExit:错误:命令’gcc’失败,退出状态为1。与python设置不正确有关吗?我已经尝试了多种安装软件包的方法,但是每当我运行setup.py时,它都会显示错误消息。我可以将pygame文件夹移到某个地方,使其成为python模块的一部分吗?您的帮助将不胜感激!这是错误消息:

  • 我试图安装Android ADT的Eclipse从http://developer.android.com/sdk/installing/installing-adt.html 并得到以下错误: 如果有帮助的话,我正在运行windows8.1并使用最新版本的Eclipse。非常感谢。

  • 问题内容: Node和npm均已安装并且是最新的,但是在尝试安装coffeescript时始终出现此错误。我还是编程新手,所以任何建议都将不胜感激。 问题答案: 错误消息非常清楚: 您没有必要的权限,因此无法安装。尝试使用: npm作者建议不要使用,因为软件包可以运行任意命令,因此很危险。他建议将的所有权切换到您的用户。我认为这是一种可怕的建议,只会给您一种错误的安全感:如果一个程序包可以运行任意

  • 我一直在尝试在ubuntu16上安装xampp(5.6.24)。04,但我遇到了以下错误- /opt/lampp/etc/httpd的第136行出现语法错误。conf:无法加载模块/mod_ssl。所以进入服务器:/opt/lampp/modules/mod_ssl。所以:无法打开共享对象文件:没有这样的文件或目录 我尝试过在互联网上搜索,但是找不到任何专门针对ubuntu的东西。 任何建议都可能

  • 我在Google Colab上安装火花时出错。它说 tar:spark-2.2.1-bin-hadoop2.7.tgz:无法打开:没有这样的文件或目录tar:错误不可恢复:现在退出。 这是我的步骤 ! apt-get install openjdk-8-jdk-head less-qq 在此输入图像描述

  • 问题内容: 我没有直接依赖于weak或node-gyp,但是我想我的其他依赖项(express,phantom,ejs,aws- sdk,moment)都需要它。任何人都遇到这样的问题并能够解决? 问题答案: 这是有效的。在安装过程中需要python 2.6。 https://github.com/TooTallNate/node- gyp/issues/363