【发布时间】:2012-02-19 13:27:43
【问题描述】:
我已经从 Python 2.7 源代码完成 altinstall 并创建了一个“更新替代”链接。
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzvf Python-2.7.2.tgz
cd Python-2.7.2
./configure
make
make altinstall
之后
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7/bin/python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.5 1
在shell中运行良好:
sudo update-alternatives --config python
python
Python 2.7.2 (default, Feb 19 2012, 11:09:25)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
但 Django 调试模式仍然告诉我:
Python 版本:2.5.2
如何在 Debian 5 Lenny for Django 应用上将 Python 2.7.2 设置为默认版本?
【问题讨论】:
-
你在使用 apache 和 mod_wsgi 吗?如果是这样,您可能必须针对 python 2.7.2 编译 mod_wsgi。 (即:./configure --with-python=/opt/python2.72/bin/python,同时使用你的python 2.7.2路径)你也可以把它放在apache httpd.conf中:WSGIPythonHome /opt/python2 .7(再次使用您的路径)。