Error: b’You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n’
pip install psycopg2==2.8 -i https://pypi.tuna.tsinghua.edu.cn/simple/
报错:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting psycopg2==2.8
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c7/ca/75236b17f1b951950ffc55d657c5aa408d3d0327a1b6c4c0f7cb16ef7e7b/psycopg2-2.8.tar.gz (367 kB)
ERROR: Command errored out with exit status 1:
command: /home/python/.virtualenvs/py3_sf/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pvc0mswm/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pvc0mswm/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 /tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info
cwd: /tmp/pip-install-pvc0mswm/psycopg2/
Complete output (7 lines):
running egg_info
creating /tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-pvc0mswm/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
关键错误看下图标注:
解决:
sudo apt-get install libpq-dev
安装成功后,再次以下安装命令
pip install psycopg2==2.8 -i https://pypi.tuna.tsinghua.edu.cn/simple/
成功安装!!!