Centos7系统python3及pip安装

安装python3支持包

#yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel zlib-devel gcc gcc-c++

下载python3.x的taz源码包

#wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

Centos7系统python3及pip安装

进行解压编译安装

#tar -xvf Python-3.6.1.tgz
#cd Python-3.6.1.tgz
#./configure --prefix=/usr/local/
#make && make altinstall

备份原python创建python3和python2软连接

#cd /usr/bin
#mv python python.backup
#ln -s /usr/local/bin/python3.6 /usr/bin/python3
#rm -rf /usr/bin/python2
#ln -s /usr/bin/python2.7 /usr/bin/python

查看python版本(-V或者进入python查看)

(python3进入python3.6.1)

(python进入python2.7.5)

Centos7系统python3及pip安装
Centos7系统python3及pip安装

python3安装pip

下载源码包

#wget https://bootstrap.pypa.io/get-pip.py

Centos7系统python3及pip安装

python3进行安装

#python3 get-pip.py

Centos7系统python3及pip安装

pip安装测试

Centos7系统python3及pip安装

上一篇:Linux:CentOS7下安装Nginx的详细步骤


下一篇:编译安装curl或libcurl-devel