centos7 安装python3

2021-07-16 13:07

阅读:599

标签:amp   python2.7   备份   line   指定   roo   bzip   pre   bsp   

1、安装依赖

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

 

2、下载python包

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

 

3、解压、编译

tar xf Python-3.6.4.tgz -C /usr/local/
cd  /usr/local/Python-3.6.4
./configure
make && make install

 

4、备份旧版本python依赖,链接新版本python

mv /usr/bin/python{,.bak}
[root@zabbix-server local]# ln -s /usr/local/bin/python3.6 /usr/bin/python
[root@zabbix-server local]# python -V
Python 3.6.4

 

5、修改yum配置文件

将第一行指定的python版本改为python2.7(#!/usr/bin/python 改为 #!/usr/bin/python2.7)

 

centos7 安装python3

标签:amp   python2.7   备份   line   指定   roo   bzip   pre   bsp   

原文地址:https://www.cnblogs.com/root0/p/9534334.html


评论


亲,登录后才可以留言!