系统环境
OS:Oracle Linux Enterprise 5.6
1.下载
Python
地址:
版本: Python-2.7.3.tgz
setuptools
地址:
版本:setuptools-0.6c11.tar.gz(md5)
也可以采用wget方式下载:
wget #md5=7df2a529a074f613b509fb44feefe74e
2.安装Python
--查看系统自带的python:
[root@njdyw ~]# python
python python2 python2.4
--安装Python2.7.3
[root@njdyw ~]# mkdir /python
[root@njdyw ~]# cp Python-2.7.3.tgz /python/
[root@njdyw ~]# cd /python/
[root@njdyw python]# ls
Python-2.7.3.tgz
--解压
[root@njdyw python]# tar -zvxf Python-2.7.3.tgz
[root@njdyw python]# ls
Python-2.7.3 Python-2.7.3.tgz
--configure:避免对原有的Python产生影响,必须制定prefix。
[root@njdyw python]# cd Python-2.7.3
[root@njdyw Python-2.7.3]# ./configure --prefix=/usr/local/python2.7.3
--make:
[root@njdyw Python-2.7.3]# make
--make install:
[root@njdyw Python-2.7.3]# make install
安装成功后目录为:
[root@njdyw Python-2.7.3]# ll /usr/local/python2.7.3/
总计 16
drwxr-xr-x 2 root root 4096 03-21 10:12 bin
drwxr-xr-x 3 root root 4096 03-21 10:07 include
drwxr-xr-x 4 root root 4096 03-21 10:07 lib
drwxr-xr-x 3 root root 4096 03-21 10:07 share
--建立软链接:
[root@njdyw Python-2.7.3]# ln -s /usr/local/python2.7.3/bin/python /bin/python2.7.3
[root@njdyw Python-2.7.3]# python
python python2 python2.4 python2.7.3
[root@njdyw Python-2.7.3]# python2.7.3
Python 2.7.3 (default, Mar 21 2013, 10:06:48)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 1
1
>>>
Linux下Python环境搭建
内容版权声明:除非注明,否则皆为本站原创文章。