目前 Ubuntu14.04 16.04 LTS 停止更新了,16.04 py的版本停在了Python 2.7.12及Python 3.5.2
如何升级python呢,有网文说自己编译一个,这倒是可行就是麻烦了点。
这里提供一个网址可以更新你的python 介绍详见下
14.04 能升级到python 3.7 ;16.04 能升级到python 3.10
在命令行输入
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
以16.04为例
sudo apt search python3.10
#可以看见 python 3.10 组件
idle-python3.10/xenial,xenial 3.10.0~a6-159-g4827483f47-1+xenial1 all
IDE for Python (v3.10) using Tkinter
libpython3.10/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Shared Python runtime library (version 3.10)
libpython3.10-dbg/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Debug Build of the Python Interpreter (version 3.10)
libpython3.10-dev/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Header files and a static library for Python (v3.10)
libpython3.10-minimal/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Minimal subset of the Python language (version 3.10)
libpython3.10-stdlib/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Interactive high-level object-oriented language (standard library, version 3.10)
libpython3.10-testsuite/xenial,xenial 3.10.0~a6-159-g4827483f47-1+xenial1 all
Testsuite for the Python standard library (v3.10)
python3.10/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Interactive high-level object-oriented language (version 3.10)
python3.10-dbg/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Debug Build of the Python Interpreter (version 3.10)
python3.10-dev/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Header files and a static library for Python (v3.10)
python3.10-distutils/xenial,xenial 3.10.0~a6-159-g4827483f47-1+xenial1 all
distutils package for Python (version 3.10)
python3.10-examples/xenial,xenial 3.10.0~a6-159-g4827483f47-1+xenial1 all
Examples for the Python language (v3.10)
python3.10-gdbm/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
GNU dbm database support for Python (version 3.10)
python3.10-gdbm-dbg/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
GNU dbm database support for Python (version 3.10 debug extension)
python3.10-lib2to3/xenial,xenial 3.10.0~a6-159-g4827483f47-1+xenial1 all
lib2to3 package for Python (version 3.10)
python3.10-minimal/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Minimal subset of the Python language (version 3.10)
python3.10-tk/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Tkinter - Writing Tk applications with Python (version 3.10)
python3.10-tk-dbg/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Tkinter - Writing Tk applications with Python (version 3.10 debug extension)
python3.10-venv/xenial 3.10.0~a6-159-g4827483f47-1+xenial1 amd64
Interactive high-level object-oriented language (pyvenv binary, version 3.10)
然后安装 3.10
sudo apt-get install python3.10
#提示安装 libpython3.10-minimal libpython3.10-stdlib python3.10-minimal 等python3.10 组件
[sudo] admin1 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
libpython3.10-minimal libpython3.10-stdlib python3.10-minimal
建议安装:
python3.10-venv binfmt-support
下列【新】软件包将被安装:
libpython3.10-minimal libpython3.10-stdlib python3.10 python3.10-minimal
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 165 个软件包未被升级。
需要下载 4,364 kB 的归档。
解压缩后会消耗 19.0 MB 的额外空间。
您希望继续执行吗? [Y/n]
后续的排错,网文 ubuntu16.04安装python3 不错可以参考一下,但请注意
sudo add-apt-repository ppa:fkrull/deadsnakes 这个仓库已经不用了,用上文提供的仓库。
另外 https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly?field.series_filter=xenial
也是ubuntu python的更新网址但是只有amd64架构16.04 18.04 20.04 的python更新了,这个仓库(sudo add-apt-repository ppa:deadsnakes/nightly)更新很频繁,想尝鲜的可以试一下。