Centos下安装Python3.6和Python2共存
写在前面
centos6.8中默认自带的python版本为python2.6,那么这里需要将其改为python3
下载并解压
官方下载地址为 https://www.python.org/downlo... ,这里已3.6.3为例。
# 下载 wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz # 解压 tar -zxvf Python-3.6.3.tgz cd Python-3.6.3
安装
[root@localhost ~]# ./configure prefix=/usr/local/python3 --enable-optimizations [root@localhost ~]# make && make install
修改python3为默认的python
[root@localhost ~]# which python /usr/bin/python [root@localhost ~]# mv /usr/bin/python /usr/bin/python.bak /usr/bin/python [root@localhost ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python
python3和python2共存
[root@localhost ~]# python -V Python 3.6.3 [root@localhost ~]# python2.6 -V Python 2.6.6
由于yum用的python仍然是2.6,所以这里修改一下
[root@localhost ~]# vim /usr/bin/yum
将第一行改为:
#!/usr/bin/python2.6原文地址:http://www.tech1024.com/origi...
相关推荐
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
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
Erick 2020-11-17