Objective:
Python3 should be the trend of Python, of course, the current controversy is relatively large, the main purpose of this essay is to record the process of building python3 environment under linux6.4
And the problems encountered and the solution process.
In addition, if the machine installed Python2, try not to control him, using Python3 to run the Python script is good, because there may be a program dependent 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 use to say three times!
First, install the python3.5
To download the python3.5 installation package:
wget--no-check-certificate https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
Unzip 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, we need to do the following:
Cp-r/usr/local/python3.5/lib/*/usr/lib64/
Ok! The basic environment for PYTHON3 is now complete!
Second, install Pip and Setuptools
After all, the rich third-party library is the advantage of Python, in order to more easily install third-party libraries, using the PIP command, we need to do the appropriate installation.
1. Pre-installation Setuptools required before PIP installation
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 the Zlib-devel package in Linux for support.
Yum Install Zlib-devel
A recompile installation is required for the python3.5.
CD python3.5
Make & make Install
It's a long process of compiling and installing.
Reinstall Setuptools
Python3 setup.py Build
Python3 setup.py Install
2. 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
If there is no accident, PIP installation is complete.
Test:
We use PIP to install a python3 third-party library:python3-m pip install Paramiko
Nani!!!! It's another error!
Importerror:cannot import name ' Httpshandler '
Based on Swaiiow's years of experience, it should be the lack of a development environment for OpenSSL and we continue to install
Yum Install Openssl-devel
Continue to recompile the installation python3.5
OK, we finally completed the installation of the entire PYTHON3 environment.
python3.5 Study notes: linux6.4 installation python3 pip Setuptools