Psycopg2控制盘无法为MacOS生成

2024-06-26 14:21:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用MacOS并试图将我的web应用程序部署到Heroku上,但它始终无法build wheel for psycopg2。我真的尝试了一切——我发现这篇文章很有用:How to install psycopg2 with "pip" on Python?

但是,即使尝试了所有方法,车轮仍然无法制造

以下是一些有帮助的错误消息:

psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
         psycopg/psycopgmodule.c:685:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
           685 |     while (interp->next)
               |                  ^~
         error: command '/usr/bin/gcc' failed with exit code 1
         ----------------------------------------
         ERROR: Failed building wheel for psycopg2
         Running setup.py clean for psycopg2
       Successfully built alembic blinker dominate Flask-Bootstrap Flask-Mail guess-language-spirit itsdangerous Mako python-editor visitor WTForms
       Failed to build psycopg2
       Installing collected packages: SQLAlchemy, MarkupSafe, Mako, python-editor, six, python-dateutil, alembic, pytz, Babel, blinker, certifi, chardet, click, dnspython, dominate, urllib3, elasticsearch, idna, email-validator, itsdangerous, Jinja2, Werkzeug, Flask, Flask-Babel, visitor, Flask-Bootstrap, Flask-Login, Flask-Mail, Flask-SQLAlchemy, Flask-Migrate, Flask-Moment, WTForms, Flask-WTF, guess-language-spirit, PyJWT, python-dotenv, requests, psycopg2, gunicorn
           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: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nqnkr57w/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nqnkr57w/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 /tmp/pip-record-u2t7aq2l/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.9/psycopg2
                cwd: /tmp/pip-install-nqnkr57w/psycopg2/

psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
           psycopg/psycopgmodule.c:685:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
             685 |     while (interp->next)
                 |                  ^~
           error: command '/usr/bin/gcc' failed with exit code 1
           ----------------------------------------
       ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nqnkr57w/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nqnkr57w/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 /tmp/pip-record-u2t7aq2l/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.9/psycopg2 Check the logs for full command output.

Tags: installpiptopyflaskforwithsetup