Objective:
Python3 should be the trend of Python, of course, the current controversy is also relatively large, the main purpose of this essay is to record the linux6.4 under the PYTHON3 environment of the process
As well as the problems encountered and the resolution process.
In addition, if the native is installed Python2, try not to care about him, use Python3 to run the Python script, because there may be programs depending on the current python2 environment,
Like Yum ...
Do not move the existing python2 environment.
Do not move the existing python2 environment.
Do not move the existing python2 environment.
Important to use say three times. I. Installation of python3.5
Download python3.5 installation package:
wget--no-check-certificate https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
Extract to current directory:
TAR-ZXVF python-3.5.0.tgz
CD Python-3.5.0
./configure--prefix=/usr/local/python3.5--enable-shared
Make & make Install
Ln-s/usr/local/python3.5/bin/python3/usr/bin/python3
When you run the Python3 command, you will get an error and the. So file is missing, and we need to do the following:
Cp-r/usr/local/python3.5/lib/*/usr/lib64/
Ok. The PYTHON3 infrastructure is now installed. Second, install Pip and Setuptools
After all, the rich Third-party Library is the advantage of Python, in order to more easily install a Third-party library, using the PIP command, we need to do the appropriate installation. 1, before installing the PIP need to install 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
Error: Runtimeerror:compression requires the (missing) zlib module
We need to install Zlib-devel packages in Linux for support.
Yum Install Zlib-devel
The python3.5 installation needs to be recompiled.
CD python3.5
Make & make Install
is also a lengthy compilation of the installation process.
Reinstall Setuptools
Python3 setup.py Build
Python3 setup.py Install 2, Mount 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
If there are no surprises, PIP Setup is complete.
Test:
We use PIP to install a Python3 third-party library: python3-m pip install Paramiko
Nani.... It's an error again.
Importerror:cannot import name ' Httpshandler '
According to rite years of experience, should be the lack of OpenSSL development environment, we continue to install
Yum Install Openssl-devel
Continue recompiling the installation python3.5
OK, we've finally completed the installation of the entire PYTHON3 environment.
If the above python3.5 installation error, please use the following method:
Linux under
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.5
Enter python3.5 when you start.