ubuntu 安装python3.10和对应版本的pip

装的时候运行了一个apt autoremove python3.6 直接搞崩了系统上不了网了,直接重装了系统,还是要小心啊。
sudo apt-get install --reinstall ubuntu-desktop

目录

  • 1. 安装python3.10 及 对应的pip
    • 1.1安装通用软件依赖
    • 1.2 添加Ubuntu的python版本 所在的库:
    • 1.3. 安装支持的python版本Supported Ubuntu and Python Versions
    • 1.4 安装python 依赖包
    • 1.5 安装pip
    • 报错解决
      • 检查一下pip版本:No module named 'apt_pkg'
      • AttributeError: module 'collections' has no attribute 'MutableMapping'

1. 安装python3.10 及 对应的pip

需要注意的是如果直接apt-get install python3-pip的话装的不是对应的3.10版本的,可能会导致多个问题。

1.1安装通用软件依赖

sudo apt install software-properties-common

1.2 添加Ubuntu的python版本 所在的库:

sudo add-apt-repository ppa:deadsnakes/ppa

执行后看一下输出,输出会告诉我们需要做什么:

ltt@ltt-E440:~$ sudo add-apt-repository ppa:deadsnakes/ppa
 This PPA contains more recent Python versions packaged for Ubuntu.

Disclaimer: there's no guarantee of timely updates in case of security problems or other issues. If you want to use them in a security-or-otherwise-critical environment (say, on a production server), you do so at your own risk.

Update Note
===========
Please use this repository instead of ppa:fkrull/deadsnakes.

Reporting Issues
================

Issues can be reported in the master issue tracker at:
https://github.com/deadsnakes/issues/issues

Supported Ubuntu and Python Versions
====================================

- Ubuntu 18.04 (bionic) Python2.3 - Python 2.6, Python 3.1 - Python 3.5, Python3.7 - Python3.11
- Ubuntu 20.04 (focal) Python3.5 - Python3.7, Python3.9 - Python3.11
- Note: Python2.7 (all), Python 3.6 (bionic), Python 3.8 (focal) are not provided by deadsnakes as upstream ubuntu provides those packages.
- Note: for focal, older python versions require libssl1.0.x so they are not currently built

The packages may also work on other versions of Ubuntu or Debian, but that is not tested or supported.

Packages
========

The packages provided here are loosely based on the debian upstream packages with some modifications to make them more usable as non-default

你可能感兴趣的:(linux,经验分享,linux,ubuntu,python)