1、从Index of /ftp/python/下载python的新版本。
# 我使用的wget ,我下载到了home中 wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz # 在home中解压 tar -zxf Python-3.9.0.tgz # 进入python3.9 cd Python-3.9.0 # 编译文件 时间大概有1-3分钟 ./configure --prefix=/usr/local/python3 # 编译好后,会有另外一个提示,让run ./configure xxx ./configure --enable-optimizations # 安装 make && make install # 结束 #查看python所在目录 whereis python #把新python加入python列表。 sudo update-alternatives --install /usr/bin/python python /usr/local/bin/自己的python目录 1 最后有一个 1 #查看一下当前列表 update-alternatives --list python #su 切换root用户 配置3.9为最高优先级。 键入新python的序号,回车。 #查看python版本号,显示python3.9,说明升级成功。 python --version



