Simple implementation of upgrading Centos Python2 to Python3, centospython3
1. Obtain the Python 3 package from the Python official website and switch to the/usr/local/src directory.
#wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
2. Run the following command to decompress the package:
1 xz -d Python-3.5.1.tar.xz2 tar -xf Python-3.5.1.tar.xz
3. Create the directory-python3.5 in the/usr/local path, which is the installation directory in step 1.
$mkdir /usr/local/python3.5
4. Compile and install
$cd /usr/local/src/Python-3.5.1#./configure --prefix=/usr/local/python3.5#make all#make install#make clean#make distclean
5. Go to the absolute installation path and check whether the installation is successful.
$ /usr/local/python3.5/bin/python3.5 -V Python 3.5.1
6. Check the environment variables. By default, python is searched in the PATH order when python is started. python in/usr/bin is Python2.6.
$echo $PATH /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/gordon/bin
7. Modify the soft connection and point to python3.5 when python is started.
1. Back up pythonmv/usr/bin/python/usr/bin/python2.6.62 and modify the soft connection sudo ln-s/usr/local/python3.5/bin/python3/usr/bin/python
8. Verify whether python3.5 is enabled by default.
$ python -V Python 3.5.1
The simple implementation of the above Centos Python2 upgrade to Python3 is all the content shared by the small editor. I hope you can provide a reference and support for the customer's house.