django - 尝试 pip install psycopg2==2.7 时出错。*
问题描述
我正在尝试pip install psycopg2==2.7.*
在我的 PyCharm 终端上运行该程序包,以便我可以部署我的站点,但我收到了下面显示的消息
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/a8/8f/1c5690eebf148d1d1554fc00ccf9101e134636553dbb75bdfef4f85d7647/psycopg2-2.8.5.tar.gz
ERROR: Command errored out with exit status 1:
command: /Users/applecare/PycharmProjects/learning_log/11_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/w6/sqx_mjh176x08sjppl82f1l80000gn/T/pip-install-8j8wbzsu/psycopg2/
Complete output (23 lines):
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 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
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
You should consider upgrading via the '`pip install --upgrade pip`' command.
解决方案
如果你在 Linux 上,你需要安装 PostgreSQL 来运行你的数据库,然后将客户端连接到你的 PostgreSQL 数据库,你需要其他包,比如libpq-dev,libpq5。
您可以使用以下命令安装上述软件包。
sudo apt-get install postgresql
sudo apt-get install libpq5
sudo apt-get install libpq-dev
推荐阅读
- r - 在部分匹配时合并 2 个 data.tables
- c++ - Objective-C++ 调整实例向量大小不起作用
- swift - 变量未更新 - func 采用默认变量
- swift - SwiftUI 地图相机运动
- javascript - 在包中包含 vscode 语言扩展
- javascript - 未捕获的 ReferenceError - 黄瓜节点 js
- javascript - 卡在 dropdown.js
- ios - 无限循环和线程 1:EXC_BAD_ACCESS(代码=2,地址=0x7ffeedaec488)
- assembly - 如何在 IBMPC BIOS 图形模式 16 (INT 10H/AX=0010H) 中启用文本光标?
- visual-c++ - 如何绘制这个圆而不是 Bresenham 的圆算法