System Environment
OS: Oracle Linux Enterprise 5.6
1. Download
Python
Address: http://www.python.org/getit/
Version: Python-2.7.3.tgz
Setuptools
Address: http://pypi.python.org/pypi/setuptools#downloads
Version: setuptools-0.6c11.tar.gz (md5)
You can also download it using the wget method:
Wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
2. Install Python
-- View the built-in python:
[Root @ njdyw ~] # Python
Python python2 python2.4
-- Install 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
-- Extract
[Root @ njdyw python] # tar-zvxf Python-2.7.3.tgz
[Root @ njdyw python] # ls
Python-2.7.3 Python-2.7.3.tgz
-- Configure: To avoid impact on the original Python, you must set a 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
After the installation is successful, the directory is:
[Root @ njdyw Python-2.7.3] # ll/usr/local/python2.7.3/
Total 16
Drwxr-xr-x 2 root 4096 03-21 bin
Drwxr-xr-x 3 root 4096 03-21 10: 07 include
Drwxr-xr-x 4 root 4096 03-21 10: 07
Drwxr-xr-x 3 root 4096 03-21 10: 07
-- Create a soft link:
[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
>>>