First, the preparatory work:
Yum Install Zlib-devel
Yum Install Openssl-devel
Second, installation python3.5
wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
TAR-ZXVF python-3.5.3.tgz
CD Python-3.5.3
./configure--prefix=/usr/local/python3--enable-shared
Make && make install
Iii. replacing Python in the system
Mv/usr/bin/python Python.bak
Ln-s/usr/local/python3.5/bin/python3/usr/bin/python
Since changing the system default Python will affect Yum, you need to modify the following two files:
/usr/bin/yum and/usr/libexec/urlgrabber-ext-down
1Known problems with Fedora Linux and Python 3version:error Message:2 #Yum Search Package3File"/usr/bin/yum", line 304 except Keyboardinterrupt, E:5 ^6 syntaxerror:invalid Syntax7 IfYou set Python3 globally in your system change the Yumshebang to Python2:8 #Vi/usr/bin/yum9 From :Ten #!/usr/bin/python One To : A #!/usr/bin/python2.7 - similarly:error Message: - Downloading packages: theFile"/usr/libexec/urlgrabber-ext-down", line 28 - except OSError, E: - ^ - syntaxerror:invalid Syntax + Exiting on user cancel -The issue is also related to Python 3 set as adefaultGlobal version. To fix this error update/usr/libexec/urlgrabber-ext-Down script: + #Vi/usr/libexec/urlgrabber-ext-down A From : at #!/usr/bin/python - To : - #!/usr/bin/python2.7
Iv. installation of Setuptools
wget--no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5= C607dd118eae682c44ed146367a17e26
TAR-ZXVF setuptools-19.6.tar.gz
CD setuptools-19.6
Python3 setup.py Build
Python3 setup.py Install
(If there is an error: Runtimeerror:compression requires the (missing) Zlib module, you need to install Yum install Zlib-devel, after installation to recompile python3.5:
Make && make install)
Five, install Pip
wget--no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5= 3a73c4188f8dbad6a1e6f6d44d117eeb
TAR-ZXVF pip-8.0.2.tar.gz
CD pip-8.0.2
Python3 setup.py Build
Python3 setup.py Install
To install package tests using PIP:
If an error occurs, the Yum install Openssl-devel is missing, and the python3.5 (Make&&make install) will need to be recompiled as soon as the installation is complete.
[[email protected] pip-9.0.1] # python-m pip Install Paramiko PIP is configured with locations this require TLS/SSL, however the SSL module in Python is not available. Collecting Paramiko Could not fetch URL https://pypi.python.org/simple/paramiko/: There is a problem Confirming the SSL Certificate:can ' t connect to HTTPS URL because the SSL module was not available. - skipping forParamiko
Reference:
Http://www.tuicool.com/articles/j2ueiir
Http://www.cnblogs.com/Yemilice/p/6217250.html
Install python3.5 above on CentOS