1、下载python3
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
2、解压
[[email protected] ~]# tar -xzvf Python-3.7.0.tgz
先建一个编译目录:
[[email protected] ~]# mkdir /usr/local/python3
Python3.7版本需要一个新的包libffi-devel,安装此包之后再次进行编译安装即可。
[[email protected] ~]# yum install -y libffi-devel
然后编译、安装:
[[email protected] ~]# cd Python-3.7.0 [[email protected] ~]# ./configure --prefix=/usr/local/python3 [[email protected] ~]# make [[email protected] ~]# make install
建立软链接:
[[email protected] ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
查看版本:
[[email protected] ~]# python3 -V Python 3.7.0
安装结束!
原文地址:https://www.cnblogs.com/lee-qi/p/11452330.html
时间: 2024-10-09 04:29:42