Objective:
If you are also using the CentOS system, plan to install python3.0 above version, and then install the Python download tool pip, then congratulations, you may also encounter a variety of problems like me!
Another very important point: CentOS will come with a Python version, such as centos6.4 bring python2.4, try not to control it, because there are programs may rely on the current python2 environment, such as Yum.
If you move it there will be a situation where yum cannot be used, the worst of which is to overwrite or remove the original/usr/bin/python, no backup (I am). In this case, it is recommended to reinstall the system, and then follow the steps below to install.
My own before installing Setuptoos also appeared raise Urlerror. Search for a long time did not search the solution, anyway, re-follow the following steps, the final will be successful!
Focus: (Several pits I've stepped on)
Install Python before you try to install the following packages, too many pits, are tears
Yum Install Gcc-y
Yum Install zlib zlib-devel-y
Yum Install OpenSSL openssl-devel-y
First, install the python3.5
wget python3.5 installation package from the official website:
wget--no-check-certificate https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
Unzip to your installation directory (Unified installation package directory, easy to manage):
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 Setuptools and PIP
A rich third-party library is the advantage of Python, and for easier installation of third-party libraries, the use of the PIP command requires an 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.tar.gz
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.
Re-install 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
Test:
We use PIP to install a python3 third-party library: python3-m pip install Paramiko
(many other places such as the Liao Xuefeng website is about pip install installation, here I do not seem to be!) )
Error:importerror:cannot import name ' Httpshandler '
Lack of OpenSSL development environment, continue installation
Yum Install Openssl-devel
Continue to reinstall the compilation python3.5 (others do not need to be recompiled)
Execute the installation command again, successfully.
This article is from the "it--Brother" blog, please make sure to keep this source http://402753795.blog.51cto.com/10788998/1859443
python3.5.2 Installing PIP management tools