1. Check the existing Python version
[Root@xu ~]# Python-v
Python 2.6.6
[Root@xu ~]#
2. Download Python3.4.3
Download and upload to the TMP directory
[Root@xu tmp]# ls
Python-3.4.3.tgz Yum.log
[Root@xu tmp]#
3. Create a Python installation directory
[Root@xu tmp]# mkdir/opt/python3.4
4. Unzip the tar file
[Email protected] tmp]# TAR-ZXVF python-3.4.3.tgz
[Email protected] tmp]# CD Python-3.4.3
[Email protected] python-3.4.3]# pwd
/tmp/python-3.4.3
5. Configuration and Installation
[Email protected] python-3.4.3]#/configure--prefix=/opt/python3.4/
[[email protected] python-3.4.3]# make
[[email protected] python-3.4.3]# make install
6. establish a soft connection so that the system default Python points to the newly installed Python
[Email protected] tmp]# mv/usr/bin/python/usr/bin/python2.6.6
[email protected] tmp]# ln-s/opt/python2.7/bin/python2.7/usr/bin/python
[Email protected] tmp]# python-v
Python 3.4.3
Yes, to this upgrade success, and then edit the Yum default python for the old version of Python
[Email protected] tmp]# Vim/usr/bin/yum
Modify the first line as follows
Modified before: #!/usr/bin/python
Modified: #!/usr/bin/python2.6.6
Save exit: (Vim command): Wq
Note: Easy_install and PIP are not installed, and you need to configure environment variables after installation.
Download setuptools-18.3.2.tar.gz
Unzip and install
[Email protected] tmp]# TAR-ZXVF setuptools-18.3.2.tar.gz
[[email protected] setuptools-18.3.2]# python setup.py install
Install PIP
[[email protected] tmp]# easy_install pip
-bash:easy_install:command not found
Configuring Python Environment variables
[Email protected] tmp]# Vim/etc/profile
At the back, add
python_home=/opt/python3.4
Export path= $PYTHON _home/bin: $PATH
Save exit
[Email protected] tmp]# Source/etc/profile
Execute the above command, the environment variable takes effect immediately
Install PIP
[[email protected] tmp]# easy_install pip
Searching for PIP
Best Match:pip 6.0.8
Adding pip 6.0.8 to easy-install.pth file
installing PIP Script To/opt/python3.4/bin
Installing pip3.4 Script To/opt/python3.4/bin
Installing PIP3 Script To/opt/python3.4/bin
Using/opt/python3.4/lib/python3.4/site-packages
Processing dependencies for PIP
Finished processing dependencies for PIP
This Ok,python upgrade is complete, Easy_install and PIP commands can be used normally
CentOS6.7 Upgrade Python3.4.3