1、python查看之前的版本python –version(以下操作都是在root用户下或者sudo执行)2、安装python3.6的依赖包
yum -y groupinstall "Development tools"
3、安装其他依赖包
yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
4、python3.6下载如果安装其他版本,可去官网直接下载
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
5、创建文件夹
mkdir /usr/local/python3
6、解压python3.6安装包
tar -xzjf Python-3.6.4.tar.xz
7、设置安装路径
cd Python-3.6.4 ./configure --prefix=/usr/local/python3
8、编译并安装python如果编译时遇到问题,百度一下就能找到
make && make install
9、设置软连接到/usr/bin目录
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
至此安装成功
评论前必须登录!
注册