wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz--no-check-certificat
Gunzip python-3.6.1.tgz
Tar XF python-3.6.1.tgz
CD Python-3.6.1
Mkdir/usr/local/python36
./configure--prefix=/usr/local/python36/
Make && make install
Then an error occurs:
Zipimport. Zipimporterror:can ' t decompress data; Zlib Not available
Workaround:
First verify that the zlib and Zlib-devel are installed.
[Email protected] python-3.6.1]# pwd
/home/oracle/scripts/python-3.6.1
Then CD modules/
Modify Setup
Find the following sentence, remove the comment
#zlib zlibmodule.c-i$ (prefix)/include-l$ (exec_prefix)/lib-lz
Then re-execute the following:
./configure--prefix=/usr/local/python36/
Make && make install
Since the system itself is a 2.x version:
[Email protected] python-3.6.1]# mv/usr/bin/python/usr/bin/python_2.x
[Email protected] python-3.6.1]# Ln-sv/usr/local/python36/bin/python3/usr/bin/python
Python3 python3.6 python3.6-config python3.6m python3.6m-config python3-config
[Email protected] python-3.6.1]# Ln-sv/usr/local/python36/bin/python3.6/usr/bin/python
'/usr/bin/python ', '/usr/local/python36/bin/python3.6 '
[[email protected] python-3.6.1]# Python
Python 3.6.1 (default, Jul 13 2017, 14:31:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on Linux
Type "Help", "copyright", "credits" or "license" for more information.
>>> exit ()
After the installation of the python3.6 version is complete, the original Yum will not be available for the following modifications:
Edit the first line of/usr/bin/yum:
#!/usr/bin/python2.6 changed it so that it could be used.
Installing python3.6 in a Linux environment