linux install python3 and pip3
linux system (centos, redhat) comes under normal circumstances python2 and pip, but now the mainstream version of python is python3, so it is necessary python2 and python3 coexist.
1. Install depend on the environment
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2. Install the gcc compiler
yum install gcc -y
3. Download the installation package python
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
#可以直接去python官网自己下载,不过注意版本!推荐使用双数
4. speak directly to the installation package movement in / usr / local /
mv Python-3.6.5.tgz /usr/local/
#这里可以不需要移动,移动到需要的目录下即可(后面配置需要依次修改)
5. Create python3 installed in the local directory folder
mkdir /usr/local/python3
6. Go to the directory where the Python-3.6.5.tgz under
cd /usr/local/
7. extracting installation package
tar -xvf Python-3.6.5.tgz
8. unzip the file into the folder
cd /usr/local/Python-3.6.5/
9. Installation Directory Configuration
./configure --prefix=/usr/local/python3
10. Compile the source code and
make
11. compile the source code after installation
make install
12. Create a connection
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
相当于配置环境变量;这时直接输入python3 应该就可以直接进入python3的操作页面。 意味着python3 安装好了
13. Download setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz
--no-check-certificate :意味着以不安全的方法连接
##下载文件的md5校验码:c607dd118eae682c44ed146367a17e26
14. The decompression
tar -zxvf setuptools-19.6.tar.gz
15. Go to the extracted files
cd setuptools-19.6/
16. Build
python3 setup.py build
17. Install
python3 setup.py install
18. Create a soft link
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
19. Check the version pip
pip3 -V
此时显示的为python3.6的版本的pip即成功了
! ! ! Need to update the files after the update pip3, or simply restart the virtual machine