【发布时间】:2014-05-29 23:40:38
【问题描述】:
我在我的 centos 6.5 中安装了 python 3.4 我按照本教程进行操作
http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/
所以我不更改系统默认python 2.6.6
我使用 python3.4 pyvenv 为我的 django 网站创建一个项目文件夹 现在我需要安装 postgresql 数据库,所以我尝试安装 psycopg2。 在那个 pyvenv 中,python 版本是 3.4
当我 pip install 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
然后我做了一点搜索,有人说我需要安装其他库 我需要这样做
yum install libpqxx-devel python-devel
一切安装完成 但是,然后我安装 psycopg2, 点安装 psycopg2, 它仍然显示相同的错误 然后我注意到,以前的库,只安装了 python-devel-2.6.6 这是默认的系统 python 版本 即使我尝试
yum python3-devel,
它不会将 python3.4 开发库安装到我的 python3.4 pyvenv 文件夹中
我该如何解决这个问题?我可以在这个 pyvenv 文件夹中安装 python3.4 开发库吗?
【问题讨论】:
-
错误说找不到pg_config,对吧?安装了 PostgreSQL 吗?如果执行 which pg_config 会得到什么?
标签: python django postgresql python-3.x centos6