Jos*_*se 10 django psycopg2 backend python-3.x
我最近买了一台 MacBook Pro 并为其设置了一些 python 和 Django 编程,但最终在安装 psycopg2 时遇到了问题,我已经尝试了几件事,但没有一个对我有用,这里留下了错误,
\nCollecting psycopg2\n Using cached psycopg2-2.9.3.tar.gz (380 kB)\n Preparing metadata (setup.py) ... error\n error: subprocess-exited-with-error\n \n \xc3\x97 python setup.py egg_info did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [23 lines of output]\n running egg_info\n creating /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info\n writing /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/PKG-INFO\n writing dependency_links to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/dependency_links.txt\n writing top-level names to /private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/top_level.txt\n writing manifest file '/private/var/folders/7f/ssr40bmj6t3_yq0cv_43cttc0000gn/T/pip-pip-egg-info-noe7l09b/psycopg2.egg-info/SOURCES.txt'\n \n Error: pg_config executable not found.\n \n pg_config is required to build psycopg2 from source. Please add the directory\n containing pg_config to the $PATH or specify the full executable path with the\n option:\n \n python setup.py build_ext --pg-config /path/to/pg_config build ...\n \n or with the pg_config option in 'setup.cfg'.\n \n If you prefer to avoid building psycopg2 from source, please install the PyPI\n 'psycopg2-binary' package instead.\n \n For further information please check the 'doc/src/install.rst' file (also at\n <https://www.psycopg.org/docs/install.html>).\n \n [end of output]\n \n note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\nRun Code Online (Sandbox Code Playgroud)\n它表明这不是 pip 的问题,而是 setup.py 的问题,但找不到任何东西,
\n欢迎任何帮助
\n谢谢
\nAbh*_*wat 10
正如 Alex 提到的,系统上未安装 PostGreSQL 会引发错误\n安装 PostGreSQL,一切都会正常工作\n试试这个
\n\xe2\x9d\xaf brew install postgresql\n# If you open a new terminal tab you will see that pg_config is available\n\xe2\x9d\xaf export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"\n\xe2\x9d\xaf export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L${HOME}/.pyenv/versions/3.8.10/lib"\n\xe2\x9d\xaf python -V\nPython 3.9.13\n\xe2\x9d\xaf pip install psycopg2-binary==2.8.6```\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
18703 次 |
| 最近记录: |