CentOS 7下安装Python 3.5并与Python2.7兼容并存详解
本文主要给大家介绍了关于在CentOS 7下安装Python 3.5并与Python2.7兼容并存的相关内容,分享出来供大家参考学习,下面来一起看看详细的介绍:
CentOS 7下安装Python3.5
CentOS7默认安装了python2.7.5,当需要使用python3的时候,可以手动下载Python源码后编译安装。
1.安装python3.5可能使用的依赖
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
2.下载Python
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
3.解压下载好的压缩包
tar -zxvf Python-3.5.0.tgz
4.配置编译
sudo mkdir /usr/local/python3 sudo Python-3.5.0/configure --prefix=/usr/local/python3 sudo make sudo make install
5.备份旧版本python,链接新版本python
在/usr/bin中有python、python2、python2.7三个文件依次指向后者
sudo mv python python.bak, sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python
6.修改yum配置文件
sudo vi /usr/bin/yum
将第一行指定的python版本改为python2.7(#!/usr/bin/python 改为 #!/usr/bin/python2.7)
总结
相关推荐
huavhuahua 2020-11-20
weiiron 2020-11-16
cakecc00 2020-11-15
千锋 2020-11-15
JakobHu 2020-11-14
guangcheng 2020-11-13
xirongxudlut 2020-11-10
solarLan 2020-11-09
pythonxuexi 2020-11-08
文山羊 2020-11-07
susmote 2020-11-07
wuShiJingZuo 2020-11-05
Pythonjeff远 2020-11-06
jacktangj 2020-11-04
lousir 2020-11-04
Noneyes 2020-11-10
ailxxiaoli 2020-11-16
chensen 2020-11-14
Nostalgiachild 2020-11-13