How to update to the latest Python version On Linux All In One
How to update to the latest Python version On Linux All In One
update to the latest Python version on
Raspberry Pi
errors
old
$ python --version
Python 3.9.2
new
$ sudo apt update
$ apt list | grep python3.10
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libqgispython3.10.14/oldstable 3.10.14+dfsg-1 arm64
libqgispython3.10.14/oldstable 3.10.14+dfsg-1 armhf
$ sudo apt install python3.10
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
E: 无法定位软件包 python3.10
E: 无法按照 glob ‘python3.10’ 找到任何软件包

$ apt list | grep python3.10.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libqgispython3.10.14/oldstable 3.10.14+dfsg-1 arm64
libqgispython3.10.14/oldstable 3.10.14+dfsg-1 armhf
$ sudo apt install python3.10.14
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
E: 无法定位软件包 python3.10.14
E: 无法按照 glob ‘python3.10.14’ 找到任何软件包

$ python --version
solutions
- Download for macOS
Python 3.11.4

https://www.python.org/ftp/python/3.11.4/python-3.11.4-macos11.pkg

https://www.python.org/downloads/
PEP 619 – Python 3.10 Release Schedule
Release Created:25-May-2020
Python-Version: 3.10
https://peps.python.org/pep-0619/
- zsh
echo "alias py=/usr/bin/python3" >> ~/.zshrc
echo "alias python=/usr/bin/python3" >> ~/.zshrc
How to use brew install the latest python3 on macOS?
python@3.y/Python 3.y.z
# ❌
$ brew install python@3.11.4
# ✅
$ brew install python@3.11

https://formulae.brew.sh/formula/python@3.11
https://formulae.brew.sh/formula/python@3.10
https://formulae.brew.sh/formula/python@3.9
https://docs.brew.sh/Homebrew-and-Python#python-3y
https://docs.python-guide.org/starting/install3/osx/
demos
Pyhton 3.10.x
switch...case ❌
match...case ✅
#!/usr/bin/env python3
# coding: utf8
__author__ = 'xgqfrms'
__editor__ = 'vscode'
__version__ = '1.0.1'
__github__ = 'https://github.com/xgqfrms/Raspberry-Pi'
__git__ = 'https://github.com/xgqfrms/Raspberry-Pi.git'
__copyright__ = """
Copyright (c) 2012-2050, xgqfrms; mailto:xgqfrms@xgqfrms.xyz
"""
"""
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
* @created 2020-01-01
* @updated 2023-07-01
*
* @description
* @augments
* @example
* @link
*
*/
"""
# Match statements require Python `3.10` or newer Pylance ❌
def http_error(status):
match status:
case 400:
return "Bad request"
case 404:
return "Not found"
case 418:
return "I'm a teapot"
case _:
return "Something's wrong with the internet"
def test():
status = 400
message = http_error(status)
print("message =", message)
test()
"""
$ py3 ./match...case.py
"""
refs
https://cloudbytes.dev/snippets/upgrade-python-to-latest-version-on-ubuntu-linux
https://hub.tcno.co/pi/software/python-update/
©xgqfrms 2012-2021
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
未经授权禁止转载,违者必究!