摘要:centos7上默认安装的是python2,要使用 python3 则需要自行下载源码编译安装。yum -y groupinstall "Development tools"yum -y install zlib-devel bzip2-devel opens
centos7上默认安装的是python2,要使用 python3 则需要自行下载源码编译安装。
yum -y groupinstall "Development tools"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 libffi-develwget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz
更多版本见以下链接:
tar -xvJf Python-3.7.6.tar.xz切换到解压目录
./configure preix=/usr/local/python3make && make installpython3 --versionPython 3.7.6可以看到已经做好软链,如果没有软链接,可以做一下:
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3注: 如何删除软链,用rm命令即可,例如:
rm /usr/bin/pip3来源:小园科技观