简体   繁体   English

在Ubuntu 14.10上安装psycopg2

[英]Installation of psycopg2 on Ubuntu 14.10

Complete newbie here, trying to set up Django to work with PostgreSQL. 在此处完成新手操作,尝试将Django设置为可与PostgreSQL一起使用。 I am using Ubuntu 14.10 and I have also installed PostgreSQL 9.5. 我正在使用Ubuntu 14.10,并且还安装了PostgreSQL 9.5。
When I run pip install psycopg2 in terminal I get the following error: 当我在终端中运行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

I know that directory containing pg_config is /opt/PostgreSQL/9.5/bin/pg_config but I don't know how to add this directory to PATH to get my psycopg2 installed. 我知道包含pg_config的目录是/opt/PostgreSQL/9.5/bin/pg_config但是我不知道如何将此目录添加到PATH来安装我的psycopg2。 Or any another method to get psycopg2 installed so that I can interact with my PostgreSQL. 或安装psycopg2的任何其他方法,以便我可以与PostgreSQL进行交互。

Thanking you in advance. 预先感谢您。

Unless you do have a hard requirement on using the native postgresql library, I would advise you to use the pg8000 library instead because this one is pure python. 除非您确实对使用本机postgresql库有严格要求,否则我建议您改用pg8000库,因为该库是纯python。

Since I discovered it years ago, I stopped using the other one and forgot about the having to compile it on so many platforms. 自从几年前发现它以来,我就停止使用另一个,而忘记了必须在这么多平台上进行编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM