首页 > 系统相关 >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

时间:2023-08-07 23:45:53浏览次数:41  
标签:__ ... 14 Python update python How xgqfrms

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’ 找到任何软件包

image

$ 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’ 找到任何软件包

image

$ python --version

solutions

  1. Download for macOS Python 3.11.4

image

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

image

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/

  1. zsh
echo "alias py=/usr/bin/python3" >> ~/.zshrc
echo "alias python=/usr/bin/python3" >> ~/.zshrc

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:[email protected]
"""

"""

/**
 * 
 * @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

"""

(

标签:__,...,14,Python,update,python,How,xgqfrms
From: https://www.cnblogs.com/xgqfrms/p/17613043.html

相关文章

  • opencv-python 图像分割
    本章节介绍图像分割方面的算法:分水岭算法,grabcut算法,meanshift算法等知识。图像分割:将前景物体从背景中提取出来。图像分割分为传统图像分割和基于深度学习的图像分割。传统图像分割有:分水岭算法,grabcut算法,meanshift算法,背景抠出等。1分水岭算法分水岭算法是基于图像形态学......
  • 软件测试|最详细的Windows安装Python教程
    简介Python是一种简单易学的高级编程语言,在Windows系统下安装Python非常简单。本文将详细介绍Windows系统下安装Python的教程。步骤1:下载Python安装程序首先,您需要前往Python官方网站(www.python.org/downloads/)…2.x和Python3.x。因为Python2.x版本已经在2020年停止支持,所以我们......
  • Python 递归
    ##py_recursive.py#py_learn##CreatedbyZ.Steveon2023/8/721:28.##需求:通过递归查找一个目录下的所有目录和文件os模块下的三个方法:1.os.listdir()2.os.path.isdir()os.path.isdir(path)如果path是现有的目录,则返回#True。本方法会跟踪符号......
  • 安装python3.8 所对应的pandas 1.3.3 的版本
    1、进入Anacondaprompt环境 2.进入虚拟环境开始安装  ......
  • 100到python练习题(二)
    编写一个程序,判断一个字符串是否是有效的括号序列。defisValidParentheses(s):stack=[]parentheses={')':'(',']':'[','}':'{'}forcharins:ifcharinparentheses.values():stack.a......
  • python获取Excel文件中单元格公式的计算结果
    importopenpyxl#打开Excel文件wb=openpyxl.loadworkbook('data.xlsx',data_only=True)#获取WorkSheetws=wb.worksheets[0]forrowinws.rows:print(row[0].value)注意:使用openpyxl读取公式计算结果时,如果无法得到正确结果时会读出None,此时需要打开对应的excel......
  • python使用正则表达式
    Python使用正则表达式##py_regex.py#py_learn##CreatedbyZ.Steveon2023/8/717:18.##1.Python使用正则表达式,需要导入的模块re模块#2.正则表达式基本方法:#-match()#-search()#-findall()importredeftest_re():s="hellop......
  • python中创建多个Sheet的方法
    第一步:安装Python的xlsxwriter库pipinstallxlsxwriter第二步:导入xlsxwriter库importxlsxwriter第三步:向Excel文件中添加多个Sheet#创建Excel文件workbook=xlsxwriter.Workbook('test.xlsx')#通过workbook对象创建不同的Sheet,并向每个Sheet中添加数据,相关代码如下#向Exce......
  • python3 xml
    fromxml.etreeimportElementTreedefread():xml=ElementTree.parse('param.xml')items=xml.getroot()foriinrange(len(items)):item=items[i]print(type(item.find('value').text))print(item.g......
  • Python Socket编程
    Socket客户端##py_client.py#py_learn##CreatedbyZ.Steveon2023/8/716:36.#importsocketdeftest_client():#1.创建socketsocket_client=socket.socket()#2.连接到服务器socket_client.connect(("localhost",8091))......