0
点赞
收藏
分享

微信扫一扫

数据分析-47-时间序列变点检测之离线历史数据的CPD

和谐幸福的人生 2024-11-18 阅读 8
chrome前端

Python 3.8 于 2019 年 10 月发布,距今已有五年时间。2024 年 10 月是 Python 3.8 版本发布的最后一个月,从 2024 年 10 月开始,如果存在安全错误,Python 开发团队将不会修复该错误。有必要把python3.8升级python3.10。

新加apt源

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu focal-backports InRelease
Hit:4 http://mirrors.aliyun.com/ubuntu focal-security InRelease            
Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease       
Reading package lists... Done

安装python3.10

$ sudo apt-get install python3.10
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.10-minimal libpython3.10-stdlib python3.10-minimal
Suggested packages:
  python3.10-venv binfmt-support
The following NEW packages will be installed:
  libpython3.10-minimal libpython3.10-stdlib python3.10 python3.10-minimal
0 upgraded, 4 newly installed, 0 to remove and 117 not upgraded.
Need to get 5,221 kB of archives.
After this operation, 20.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.10-minimal amd64 3.10.15-1+focal1 [825 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.10-minimal amd64 3.10.15-1+focal1 [2,077 kB]                                                                                                                      
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.10-stdlib amd64 3.10.15-1+focal1 [1,763 kB]                                                                                                                    
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.10 amd64 3.10.15-1+focal1 [556 kB]                                                                                                                                
Fetched 5,221 kB in 7min 59s (10.9 kB/s)

设置默认版本为 Python3.10

查看系统已有python版本

$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root       9 Mar 13  2020 /usr/bin/python3 -> python3.8
-rwxr-xr-x 1 root root 5801848 Sep  7 18:35 /usr/bin/python3.10
-rwxr-xr-x 1 root root 5478168 Sep 11 16:02 /usr/bin/python3.8
lrwxrwxrwx 1 root root      33 Sep 11 16:02 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root      16 Mar 13  2020 /usr/bin/python3-config -> python3.8-config

1

设置Python3默认版本

将python3.8优先级设置为1

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python3 (python3) in auto mode

将python3.10设置为默认版本,优先级设置为2

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
update-alternatives: using /usr/bin/python3.10 to provide /usr/bin/python3 (python3) in auto mode

选择默认版本 python3.10

$ update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).

  Selection    Path                 Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.10   2         auto mode
  1            /usr/bin/python3.10   2         manual mode
  2            /usr/bin/python3.8    1         manual mode

Press <enter> to keep the current choice[*], or type selection number: 0

1

修复pip

$ sudo apt install python3.10-distutils
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py

权限问题

$ python3 get-pip.py --user

检查是否安装成功

python3 --version
Python 3.10.15

相关链接

https://blog.csdn.net/m0_46669450/article/details/140791499

举报

相关推荐

0 条评论