Python( Django ) pip install psycopg2 在 MacOS 中出错

马苏德·卡尼

我为我的项目设置了 virtualenv 以及何时我想运行

pip 安装 psycopg2

我在下面收到错误

ERROR: Complete output from command python setup.py egg_info:
ERROR: running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found.

pg_config is required to build psycopg2 from the source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.

If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.

For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r5/mt37g42j2h3b676lpx3qlznm0000gn/T/pip-install-yijundiy/psycopg2/

之后,我运行 brew install postgresql 然后当我想运行时:

pip install psycopg2 我收到这个错误:

Running setup.py install for psycopg2 ... error
      Running setup.py install for psycopg2 ... error
        ERROR: Complete output from command 
    ERROR: Command "/Users/masoudmk/Desktop/Masoud/projectenv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-6qi9xbe0/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/tmp/pip-record-t8hmiffn/install-record.txt --single-version-externally-managed --compile --install-headers /Users/masoudmk/Desktop/Masoud/projectenv/bin/../include/site/python3.7/psycopg2" failed with error code 1 in /private/tmp/pip-install-6qi9xbe0/psycopg2/

另外,当我使用这个命令时

须藤 python setup.py 安装

我也收到这个错误:

(null): can't open file 'setup.py': [Errno 2] No such file or directory

我应该怎么办!?

桑杰·库马尔

我认为你没有安装 Postgres,你可以使用安装

brew install postgresql

这有助于你的问题。之后就可以安装pip依赖包了

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

pip install psycopg2 == 2.6给出错误命令“ python setup.py egg_info”失败,错误代码为/ tmp / pip-build-f6rRmm / psycopg2 /

Django'pip install django-heroku'(psycopg2)错误阻止部署到Heroku

运行 python3 manage.py migrate 时 Virtualenv(Python3.5/pip3/Django2.0/psycopg2) 出错

在MacOS 10.15上安装Psycopg2 python 3.7时出错

Django / Python入门:执行python manage.py syncdb时出错-找不到psycopg2

在PostgreSQL(psycopg2)和Django上运行Python 3.4时出错

在MacOS 10.9.5上安装Psycopg2时出错

如何在Python上使用“ pip”安装psycopg2?

pip3 install cryptography MacOs 给出错误

错误:/ tmp / pip-install-YYFUnW / psycopg2 /中的命令“ python setup.py egg_info”失败,错误代码为1

尝试为python安装Postgres时出错(psycopg2)

无法通过pip install安装psycopg2软件包...这是因为Sierra吗?

pip install psycopg2损坏-警告:未使用的功能'Dprintf'

在Windows上使用`pip install django`安装django时出错

错误:psycopg2的构建轮失败-MacOS Mojave 10.14.16 python 3

在MacOS上安装Psycopg2失败

pip安装psycopg2块

pip install opencv-python在Raspbian上给出错误

使用python和psycopg2将CSV导入Postgres时出错

pip install django-graphos与python 3不兼容

Python Django安装mysql:easy_install和pip错误

Windows 7 Heroku Python Django LNK2001 psycopg2错误

macOS下使用pip install pytorch失败

django 在迁移中出错

安装 psycopg2==2.6.1 时出错

安装psycopg2 == 2.6.2时出错

“ pip install Django”给出异常

Django/Docker/Postgresql - psycopg2 错误

psycopg2的建筑轮...错误pip3安装了psycopg2吗?