2. 到此我们已经安装完成了,但是我们进入shell后,发现python还是2.4.3版本,我们需要建立一个链接
#back up old file
$mv /usr/bin/python /usr/bin/python-2.4.3.bak
#soft link to the python3.2
$ln -s /usr/locale/bin/python3.2 /usr/bin/python
#check the python version
$python -V
3. 安装配置完成后,yum可能无法正常工作,还需要做些配置。主要是由于我们修改了默认的Python版本为3.2,并修改了默认的链接。而yum需要使用原来版本的python,从而导致无法使用。所以指定老版本的python给yum调用即可。
$vi /usr/bin/yum
#将其中的/usr/bin/python修改为#/usr/bin/python2.4
#wq保存即可
#到此yum正常
原文: 备忘 linux下非root用户安装python3.1
步骤
1) 在linux下非root用户安装python3.1 (本例安装到 ~/python31 下, ~/ 为 /home/myhome )
$ cd ~/
$ mkdir python31
下载 python3.1
$ tar zxvf Python-3.1.2.tgz
$ cd Python-3.1.2
$ ./configure --prefix=/home/myhome/python31 --exec_prefix=/home/myhome/python31
$ export LANG=zh_CN.UTF-8
$ make
注意提示:
Python build finished, but the necessary bits to build these modules were not found:
_hashlib _sqlite3 _ssl
_tkinter bz2
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
说明 sqlite3 等模块需要单独下载编译
$ make install