To upgrade python in centOS, follow these steps:
1. You can use the built-in linux download tool wget to download, as shown below :(
The author installed the smallest centos system. Therefore, wget must be installed before using the compilation command. If you have installed the centos system on the interface or used a compilation tool, you can skip wget installation, directly to the following compilation steps) wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz 2, after the download is complete to the download directory, decompress the tar-xzvf Python-3.3.0.tgz
3. Enter the decompressed folder cd Python-3.3.0
4. Create a folder python3 in/usr/local before compilation (as the python installation path to avoid overwriting the old version) mkdir/usr/local/python3 (mkdir is used to create a folder here, and touch is used to create a file)
5. Start compilation and installation (
The author installed the smallest centos system. Therefore, before using the compilation command, you must install the gcc compilation kit. If you have installed the centos system on the interface or used a compilation tool, you can skip the installation of gcc, directly perform the following compilation steps ). /configure -- prefix =/usr/local/python3
Make
Make install
6. At this time, the old version is not overwritten, and the original/usr/bin/python link is changed to another name (I keep two versions, one python and one python3, so the author skipped step 1 and changed the Link name after Step 3 to python3. The reader can follow the normal steps to achieve the same effect) mv/usr/bin/python/usr/bin/python_old2 7. Create a new version of python connection ln-s/usr/local/python3/bin/python3/usr/bin/python 8. Input python-V at this time.
10. The new version of python is displayed. [idolaoxu @ localhost home] # python-VPython 3.3.0 PS: if you do not create a new installation path, python3 is directly installed by default, then, the new python version after installation should be replaced by the old version that comes with linux, and may not be overwritten. For details, refer to the installation process. You can try it yourself, of course, if you want to retain the original version, this method is best.