本文主要是介绍Centos7安装python3和pip3,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
前言
为甚么安装python3和pip3,因为20年py2就不跟新了,所以提前跑路升级python3,并汇总了我的安装过程,希望能给大家一点帮助。
安装
依赖
# 防止ImportError: cannot import name 'HTTPSHandler'
sudo yum install openssl-devel -y
# 防止ImportError: cannot import name 'zlib'
sudo yum install zlib-devel -y
Python3安装
wget --no-check-certificate https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgztar -xzvf Python-3.6.0.tgz cd Python-3.6.0sudo ./configure --prefix=/usr/local/python3/ --with-zlib=/usr/include --enable-loadable-sqlite-extensionssudo make && make install
sudo ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
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
sudo python3 setup.py build
sudo python3 setup.py install
pip3安装
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
sudo python3 setup.py build
sudo python3 setup.py install
sudo ln -s /usr/local/python3.4/bin/pip3 /usr/bin/pip3
建议把
pip
和python
分别指向pip3
和python3
!
后记
无
参考书籍:
- https://blog.csdn.net/jql1994/article/details/53096593
- https://blog.csdn.net/zuolovefu/article/details/78142612
- http://www.cnblogs.com/wenchengxiaopenyou/p/5709218.html
这篇关于Centos7安装python3和pip3的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!