简体   繁体   English

如何在centos pyvenv中安装python3.4 psycopg2

[英]how install python3.4 psycopg2 in centos pyvenv

i install python 3.4 in my centos 6.5 i follow this tutorial 我在centos 6.5中安装了python 3.4我遵循了本教程

http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/ http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/

so i do not change the system defaule python 2.6.6 所以我不更改系统默认Python 2.6.6

and i use python3.4 pyvenv create a project folder for my django website now i need install postgresql database,so i try install psycopg2. 并且我使用python3.4 pyvenv为django网站创建一个项目文件夹,现在我需要安装postgresql数据库,因此我尝试安装psycopg2。 in that pyvenv ,the python version is 3.4 在那个pyvenv中,python版本是3.4

when i pip install psycopg2,it show the error 当我pip安装psycopg2时,显示错误

Downloading psycopg2-2.5.2.tar.gz (685kB): 685kB downloaded
  Running setup.py (path:/mysns/build/psycopg2/setup.py) egg_info for package psycopg2

    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'.
    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'.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /mysns/build/psycopg2
Storing debug log for failure in /root/.pip/pip.log

then i do a little search ,someone say i need install other lib i need do this 然后我进行一些搜索,有人说我需要安装其他库,我需要这样做

yum install libpqxx-devel python-devel 百胜安装libpqxx-devel python-devel

every thing install complete however ,then i install psycopg2, pip install psycopg2, it still show the same error then i notice ,the previous lib ,only intall python-devel-2.6.6 this is the default system python version even i try 每件事安装完成,然后,我安装了psycopg2,pip安装了psycopg2,它仍然显示相同的错误,然后我注意到,以前的lib,只有intall python-devel-2.6.6,这是默认的系统python版本,即使我尝试

yum python3-devel, 百胜python3-devel,

it do not install python3.4 devel lib to my python3.4 pyvenv folder 它不会将python3.4 devel lib安装到我的python3.4 pyvenv文件夹中

how can i fix the problem? 我该如何解决这个问题? can i install python3.4 devel lib in this pyvenv folder? 我可以在pyvenv文件夹中安装python3.4 devel lib吗?

I had the same issue, i had a look around and I found out the following package that made it work: 我遇到了同样的问题,环顾四周,发现以下使它起作用的软件包:

wget https://forensics.cert.org/cert-forensics-tools-release-el7.rpm
sudo rpm -Uvh cert-forensics-tools-release*rpm
sudo yum --enablerepo=forensics install python3-psycopg2

also I found that there is a package called python33-python-psycopg2 that could help you out but I did not try it so take it as a shaky chance more than a way to go, anyway http://developerblog.redhat.com/2013/06/24/using-rhscl-django-on-python-3-with-postgresql/ you can find the explanation. 我还发现有一个名为python33-python-psycopg2的软件包可以为您提供帮助,但是我没有尝试过,因此无论如何,都将它作为一个不可靠的机会,无论如何http://developerblog.redhat.com/ 2013/06/24 / using-rhscl-django-on-python-3-with-postgresql /您可以找到说明。

python3.4 -m pip install psycopg2

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

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