我在我的centos 6.5中安装了python 3.4 我按照本教程
http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
所以我不改变系统defaule python 2.6.6
我使用python3.4 pyvenv为我的django网站创建一个项目文件夹 现在我需要安装postgresql数据库,所以我尝试安装psycopg2。 在那个pyvenv中,python版本是3.4
当我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
然后我做了一点搜索,有人说我需要安装其他的lib
我需要这样做
yum install libpqxx-devel python-devel
每件事都安装完成 然而,然后我安装psycopg2, pip安装psycopg2, 它仍然显示相同的错误 然后我注意到,前一个lib,只有intall python-devel-2.6.6 这是默认的系统python版本 即便我尝试
yum python3-devel,
它没有将python3.4 devel lib安装到我的python3.4 pyvenv文件夹
我该如何解决这个问题?我可以在这个pyvenv文件夹中安装python3.4 devel lib吗?
答案 0 :(得分:1)
我遇到了同样的问题,我环顾四周,发现了以下使其成功的软件包:
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
我也发现有一个名为python33-python-psycopg2的软件包可以帮助你,但我没有尝试过,所以把它当作一个不稳定的机会,不管怎么说,无论如何http://developerblog.redhat.com/2013/06/24/using-rhscl-django-on-python-3-with-postgresql/你可以找到解释。
答案 1 :(得分:0)
python3.4 -m pip install psycopg2