1. Download the python version you want to upgrade (I am upgrading the python3.3.0)
You can use the system's own download tool wget download:
wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz
You can also visit http://www.python.org/ftp/python/ ,直接下载到系统中
Tip: After you use wget download, download the file in your current working directory. (Do not find the file after download, ha)
2. Preparatory work
Unzip the downloaded file:
@1, you can use the Linux system right-click "Extract Here",
@2, direct decompression TAR-XZVF python-3.3.0.tgz
The following action: Must be in the extracted folder directory to enter the command
CD Python-3.3.0
(Recommended action below)
Create a new Python3 folder in/usr/local before compiling, so you don't have to overwrite the old version of the path
Mkdir/usr/local/python3
Start compiling and performing the reinstallation
@1,./configure--prefix=/usr/local/python3
Description: Why the following, plus the execution parameters:
The effect after execution:
After the execution succeeds, compiles, installs, the Python-3.3.0 inside the automatically generated directory and the file all is copied to you--prefix after the specified folder directory,
Why:
Uninstall the software or porting software, when a software installation is not required, simply delete the directory, you can uninstall the software cleanly, the transplant group only need to copy the entire directory to another machine;
@2,make
@3,make Install
At this time the system has been installed Python-3.3.0, the following is to establish a link, the current 3.3 as the default version, but we do not want to kill the old version
mv/usr/bin/python/usr/bin/python_2.6.6 (or/usr/bin/python_old name, whatever you want)
Next, the default version number is:
Ln-s/usr/local/python3/bin/python3/usr/bin/python
Note: (Here, used, the new Python3 directory, the root of the file compiled in the directory to replace, this is a big role)
3. Verify that:
Python
Show version number:
3.3.0. Ok
Add the following:
# yum, when the version is upgraded, the Yum command goes wrong because Yum is based on Python and does not match the Python version that Yum relies on (this is like Microsoft's. NET framework3.4 4.0. 4.5), your code compilation environment is different, the program should also make corresponding changes;
Because, above, in the upgrade version, we did not kill the old version of Python, but replaced the old version of the Python path, so we need to edit the Vim/usr/bin/yum file, modify the first line of comments
#!/usr/bin/python**** (old version number)
Contact the above and change it into #!/usr/bin/python_old
4. View Yum version
[Email protected] ~]# Rpm-qa |grep Yum
5 , view the Python version (using the previous version of the path configuration yum is ok)
[[email protected] ~]# Whereis python
Upgrade steps for Python version under Linux