python 在linux下 的编译安装


1、安装
[root@auh1st ~]# cd /usr/local/src/
[root@auh1st src]# ll
总计 0
[root@auh1st src]# wget http://www.python.org/ftp/python/2.6/Python-2.6.tar.bz2


[root@auh1st src]# tar -jxf Python-2.6.tar.bz2 
[root@auh1st src]# ll
总计 10724
drwxrwxr-x 17 1000 1000     4096 2008-10-03 Python-2.6
-rw-r--r--  1 root root 10957859 2008-10-03 Python-2.6.tar.bz2




[root@auh1st Python-2.6]# ./configure --prefix=/usr/local/python-2.6


make && make install


2、检测和设置环境变量


[root@auh1st bin]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin


[root@auh1st bin]# PATH="$PATH":/usr/local/python-2.6/bin
[root@auh1st bin]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/python-2.6/bin


3、删除系统已有的,将新版本覆盖
cd /usr/bin
rm -rf python
ln -s /usr/local/python-2.6/bin/python ./python




[root@auh1st ~]# python
Python 2.6 (r26:66714, Sep 25 2013, 10:14:04) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 


至此python新版 安装成功
Logo

更多推荐