"""
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
#运行这个命令添加epel扩展源
sudo yum -y install epel-release
#安装pip
sudo yum install python-pip
pip install wget
# 清除 cache
$ sudo yum clean all
sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
#解压
xz -d Python-3.6.4.tar.xz
tar -xf Python-3.6.4.tar
#进入解压后的目录,依次执行下面命令进行手动编译
./configure prefix = /usr/local/python3
make && make install
# 如果报错的话
sudo yum -y install zlib*
vim module/setup
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
去掉注释
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
sudo make && sudo make install
#测试是否安装成功了
python3 -V
vi /usr/bin/yum
把#! /usr/bin/python修改为#! /usr/bin/python2
vi /usr/libexec/urlgrabber-ext-down
把#! /usr/bin/python 修改为#! /usr/bin/python2
vi /usr/bin/firewall-cmd
将第一行#!/usr/bin/python -Es
修改为 #!/usr/bin/python2.7 -Es 保存并退出再次执行firewall-cmd即可。
yum -y install firewall-config
"""
Centos安装python3并设为默认
最新推荐文章于 2024-07-01 18:36:44 发布