我想在服务器上安装psycopg for python,但我遇到了一些版本问题。有没有办法可以指定在安装过程中使用哪个版本?
这就是我所拥有的
dpkg -l |grep python
ii python 2.7.3-4+deb7u1 all interactive high-level object-oriented language (default version)
ii python-central 0.6.17 all register and build utility for Python packages
iU python-psycopg2 2.4.5-1 amd64 Python module for PostgreSQL
ii python2.6 2.6.8-1.1 amd64 Interactive high-level object-oriented language (version 2.6)
ii python2.7 2.7.3-6 amd64 Interactive high-level object-oriented language (version 2.7)
我想使用python2.6.8-1.1来安装psycopg,但这是我在尝试安装时得到的
dpkg: dependency problems prevent configuration of python-psycopg2:
python-psycopg2 depends on python-egenix-mxdatetime; however:
Package python-egenix-mxdatetime is not installed.
python-psycopg2 depends on python (<< 2.7); however:
Version of python on system is 2.7.3-4+deb7u1.
dpkg: error processing python-psycopg2 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-psycopg2
如何设置和指定使用python版本2.6.8-1.1?
答案 0 :(得分:0)
安装系统软件包时,您将获得系统打包版本。如果这些版本恰好在软件包之间不兼容,那么您应该向维护者提交这个问题。
如果你想要另一个python解释器版本,可能有一个存储库,否则你只需要下载源代码并自己编译。
如果要控制Python软件包的版本(而不是解释器),则应设置virtualenv并使用pip安装到其中。现在,如果要运行具有这些依赖项的脚本,请激活virtualenv。
virtualenv -p /usr/bin/python2.6 my_env
source my_env/bin/activate
pip install psycopg2