[root@localhost ~]# python
#切换至/usr/local/目录下
[root@localhost ~]# cd /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec sbin share src
#下载依赖包
[root@localhost local]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
# 官方地址
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
# 国内镜像
wget http://npm.taobao.org/mirrors/python/3.9.0/Python-3.9.0.tgz
[root@localhost local]# wget http://npm.taobao.org/mirrors/python/3.9.0/Python-3.9.0.tgz
# 解压压缩包
tar -zxvf Python-3.9.0.tgz
# 进入文件夹
cd Python-3.9.0
# 配置安装位置
./configure prefix=/usr/local/python3
# 安装
make && make install
[root@localhost local]# ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3.9
[root@localhost local]# ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3.9
[root@localhost local]# python3.9 -V
Python 3.9.0
[root@localhost local]# python3.9
Python 3.9.0 (default, Oct 6 2021, 11:22:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("hell0 word!")
hell0 word!
>>>
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/m0_51160032/article/details/120622656
内容来源于网络,如有侵权,请联系作者删除!