在这里完成新手操作,尝试将Django设置为与PostgreSQL一起使用。我正在使用Ubuntu 14.10,并且还安装了PostgreSQL 9.5。在终端中
运行时pip install psycopg2
,出现以下错误:
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
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'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-la8dJp/psycopg2
我知道包含pg_config的目录是,/opt/PostgreSQL/9.5/bin/pg_config
但是我不知道如何将该目录添加到PATH来安装我的psycopg2。或安装psycopg2的任何其他方法,以便我可以与PostgreSQL进行交互。
预先感谢您。
除非您对使用本机postgresql库有硬性要求,否则我建议您改用pg8000库,因为该库是纯python。
自从几年前发现它以来,我就停止使用另一个,而忘记了必须在这么多平台上进行编译。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句