文章目录

注意事项当前的python 3.10当前的python3python 3.8 安装python 3.8 与 python 3.10的切换ubuntu22.04 卸载 python3.10 包时卸载的所有包

注意事项

千万千万不要卸载 系统自带的 python卸载了也不要怕

卸载了 图形界面 都打不开了,因为卸载 python3.10 的时候 同时卸载了 一些图形界面的依赖

但是ssh还是能上去的,毕竟 python 不是init系统组件,不会导致系统无法启动

1. python 切回到 python 3.10

2. 去 /var/log/apt/history.log 找到你卸载 python3.10 时 所有的卸载了哪些包

3. 重新安装这些包

当前的python 3.10

ii libpython3.10:amd64 3.10.6-1~22.04.2ubuntu1.1 amd64 Shared Python runtime library (version 3.10)

ii libpython3.10-dev:amd64 3.10.6-1~22.04.2ubuntu1.1 amd64 Header files and a static library for Python (v3.10)

ii libpython3.10-minimal:amd64 3.10.6-1~22.04.2ubuntu1.1 amd64 Minimal subset of the Python language (version 3.10)

ii libpython3.10-stdlib:amd64 3.10.6-1~22.04.2ubuntu1.1 amd64 Interactive high-level object-oriented language (standard library, version 3.10)

ii python3.10 3.10.6-1~22.04.2ubuntu1.1 amd64 Interactive high-level object-oriented language (version 3.10)

ii python3.10-dev 3.10.6-1~22.04.2ubuntu1.1 amd64 Header files and a static library for Python (v3.10)

ii python3.10-minimal 3.10.6-1~22.04.2ubuntu1.1 amd64 Minimal subset of the Python language (version 3.10)

当前的python3

ii python-dev-is-python3 3.9.2-2 all symlinks /usr/bin/python-config to python3-config

ii python-is-python3 3.9.2-2 all symlinks /usr/bin/python to python3

ii python3-apt 2.4.0ubuntu1 amd64 Python 3 interface to libapt-pkg

ii python3-blinker 1.4+dfsg1-0.4 all fast, simple object-to-object and broadcast signaling library

ii python3-cffi-backend:amd64 1.15.0-1build2 amd64 Foreign Function Interface for Python 3 calling C code - runtime

ii python3-cryptography 3.4.8-1ubuntu2 amd64 Python library exposing cryptographic recipes and primitives (Python 3)

rc python3-cupshelpers 1.5.16-0ubuntu3 all Python utility modules around the CUPS printing system

ii python3-dbus 1.2.18-3build1 amd64 simple interprocess messaging system (Python 3 interface)

ii python3-distro 1.7.0-1 all Linux OS platform information API

ii python3-distro-info 1.1build1 all information about distributions' releases (Python 3 module)

ii python3-gi 3.42.1-0ubuntu1 amd64 Python 3 bindings for gobject-introspection libraries

ii python3-httplib2 0.20.2-2 all comprehensive HTTP client library written for Python3

ii python3-importlib-metadata 4.6.4-1 all library to access the metadata for a Python package - Python 3.x

ii python3-jeepney 0.7.1-3 all pure Python D-Bus interface

ii python3-jwt 2.3.0-1ubuntu0.2 all Python 3 implementation of JSON Web Token

ii python3-keyring 23.5.0-1 all store and access your passwords safely

ii python3-launchpadlib 1.10.16-1 all Launchpad web services client library (Python 3)

ii python3-lazr.restfulclient 0.14.4-1 all client for lazr.restful-based web services (Python 3)

ii python3-lazr.uri 1.0.6-2 all library for parsing, manipulating, and generating URIs

ii python3-more-itertools 8.10.0-2 all library with routines for operating on iterables, beyond itertools (Python 3)

ii python3-oauthlib 3.2.0-1ubuntu0.1 all generic, spec-compliant implementation of OAuth for Python3

ii python3-pkg-resources 59.6.0-1.2ubuntu0.22.04.1 all Package Discovery and Resource Access using pkg_resources

ii python3-pyparsing 2.4.7-1 all alternative to creating and executing simple grammars - Python 3.x

ii python3-secretstorage 3.3.1-1 all Python module for storing secrets - Python 3.x version

ii python3-six 1.16.0-3ubuntu1 all Python 2 and 3 compatibility library (Python 3 interface)

ii python3-software-properties 0.99.22.7 all manage the repositories that you install software from

rc python3-uno 1:7.3.6-0ubuntu0.22.04.2 amd64 Python-UNO bridge

ii python3-wadllib 1.3.6-1 all Python 3 library for navigating WADL files

ii python3-zipp 1.0.0-3 all pathlib-compatible Zipfile object wrapper - Python 3.x

python 3.8 安装

sudo apt install software-properties-common

sudo add-apt-repository ppa:deadsnakes/ppa

// sudo add-apt-repository 'deb http://mirrors.tuna.tsinghua.edu.cn/help/debian/ buster-backports main'

// sudo add-apt-repository --remove 'deb http://mirrors.tuna.tsinghua.edu.cn/help/debian/ buster-backports main'

sudo apt install software-properties-common

sudo echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/backports.list

sudo apt update

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys

// sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553

sudo apt update

// 安装python3.8

sudo apt install python3.8 libpython3.8-dev python3.8-dev python3.8-distutils

ii libpython3.8:amd64 3.8.17-1+jammy1 amd64 Shared Python runtime library (version 3.8)

ii libpython3.8-dev:amd64 3.8.17-1+jammy1 amd64 Header files and a static library for Python (v3.8)

ii libpython3.8-minimal:amd64 3.8.17-1+jammy1 amd64 Minimal subset of the Python language (version 3.8)

ii libpython3.8-stdlib:amd64 3.8.17-1+jammy1 amd64 Interactive high-level object-oriented language (standard library, version 3.8)

ii python3.8 3.8.17-1+jammy1 amd64 Interactive high-level object-oriented language (version 3.8)

ii python3.8-dev 3.8.17-1+jammy1 amd64 Header files and a static library for Python (v3.8)

ii python3.8-minimal 3.8.17-1+jammy1 amd64 Minimal subset of the Python language (version 3.8)

python 3.8 与 python 3.10的切换

python 3.18

$ sudo ln -sf /usr/bin/python3.8-config /usr/bin/python3-config

$ sudo ln -sf /usr/bin/python3.8 /usr/bin/python3

$ ls -l /usr/bin/python*

lrwxrwxrwx 1 root root 7 10月 11 2021 /usr/bin/python -> python3

lrwxrwxrwx 1 root root 18 6月 11 15:30 /usr/bin/python3 -> /usr/bin/python3.8

lrwxrwxrwx 1 root root 25 6月 11 16:18 /usr/bin/python3-config -> /usr/bin/python3.8-config

lrwxrwxrwx 1 root root 14 10月 11 2021 /usr/bin/python-config -> python3-config

python 3.10

$ sudo ln -sf /usr/bin/python3.10-config /usr/bin/python3-config

$ sudo ln -sf /usr/bin/python3.10 /usr/bin/python3

$ ls -l /usr/bin/python*

lrwxrwxrwx 1 root root 7 10月 11 2021 /usr/bin/python -> python3

lrwxrwxrwx 1 root root 18 6月 11 15:30 /usr/bin/python3 -> /usr/bin/python3.10

lrwxrwxrwx 1 root root 25 6月 11 16:18 /usr/bin/python3-config -> /usr/bin/python3.10-config

lrwxrwxrwx 1 root root 14 10月 11 2021 /usr/bin/python-config -> python3-config

加入 update-alternatives

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 10

sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.10-config 10

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 8

sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.8-config 8

sudo update-alternatives --config python3

sudo update-alternatives --config python3-config

ubuntu22.04 卸载 python3.10 包时卸载的所有包

lsb-release

python3-blinker

orca

networkd-dispatcher

libglib2.0-dev-bin

printer-driver-m2300w

ssh-import-id

python3.10

python3-colorama

python3-gi

python3-tz

gnome-user-docs

libatk-bridge2.0-dev

nautilus-extension-gnome-terminal

python3-samba

python3-distupgrade

python3-brlapi

update-manager

python3-dnspython

python3-dateutil

dnf

printer-driver-foo2zjs-common

gyp

usb-creator-common

libglib2.0-dev

python3-monotonic

python3-cffi-backend

npm

samba-vfs-modules

apport-gtk

python3-lib2to3

ibus-table

ufw

python3-lazr.restfulclient

libgtk2.0-dev

python3-lockfile

python3-ibus-1.0

deja-dup

apturl-common

python3-jeepney

ubuntu-drivers-common

python3-ptyprocess

ubuntu-release-upgrader-gtk

usb-creator-gtk

trash-cli

python3-reportlab-accel

python3-distro

python3-pymacaroons

ubuntu-advantage-desktop-daemon

python3-defer

plymouth-theme-spinner

libatspi2.0-dev

python3-reportlab

language-selector-gnome

software-properties-common

nfs-common

samba

rhythmbox-plugins

python3-requests

aptdaemon

openprinting-ppds

python3-importlib-metadata

python3-speechd

plymouth-theme-ubuntu-text

python3-httplib2

python3

system-config-printer-udev

python3-urllib3

python3-aptdaemon

xserver-xorg

gedit-common

python3-software-properties

libsmbclient

python3-pyparsing

python3-lazr.uri

gnome-shell

python3-more-itertools

samba-dsdb-modules

python3-macaroonbakery

python3-wheel

nfs-kernel-server

samba-common-bin

python3-louis

python3-pkg-resources

python3-wadllib

python3-unbound

python3-gdbm

language-selector-common

system-config-printer-common

python3-libdnf

python3-talloc

printer-driver-foo2zjs

ubuntu-desktop

gdm3

python3-pexpect

totem-plugins

gnome-shell-extension-desktop-icons-ng

python3-oauthlib

node-gyp

python3-pyatspi

gnome-shell-extension-appindicator

printer-driver-postscript-hp

update-notifier

python3-mako

python3-cairo

duplicity

printer-driver-pxljr

python3-click

libatk1.0-dev

libgdk-pixbuf-2.0-dev

gvfs-backends

update-manager-core

python3-xkit

python3-fasteners

python3-apt

software-properties-gtk

gnome-online-accounts

gedit

python3-dev

python3-dnf

python3-netifaces

printer-driver-ptouch

python3-certifi

python3-renderpm

python3-gpg

xorg

python3-markupsafe

python3-distro-info

python3-jwt

ubuntu-session

python3-ldb

python3-libcomps

system-config-printer

python3-pil

python3-pip

scons

hplip

python3-rpm

python3-protobuf

python3-six

gnome-menus

python3-tdb

python3-markdown

printer-driver-sag-gdi

apturl

python3-uno

python3-nacl

python3.10-dev

ubuntu-docs

python3-xdg

python3-yaml

rhythmbox-plugin-alternative-toolbar

gnome-shell-extension-ubuntu-dock

samba-libs

gnome-control-center

ubuntu-desktop-minimal

python3-update-manager

yelp

netplan.io

python3-distutils

python3-apport

python3-keyring

python3-commandnotfound

python3-rfc3339

hplip-data

python3-aptdaemon.gtk3widgets

nautilus-share

python3-cups

python3-idna

python3-olefile

gnome-terminal

python3-pygments

ibus

libgtk-3-dev

python3-bcrypt

python3-chardet

unattended-upgrades

libcairo2-dev

python3-debconf

python3-setuptools

ubuntu-release-upgrader-core

command-not-found

python3-cryptography

ubuntu-advantage-tools

python3-launchpadlib

python3-hawkey

python3-dbus

python3-requests-toolbelt

libharfbuzz-dev

libpango1.0-dev

python3-problem-report

python3-cupshelpers

python3-future

python3-gi-cairo

apport

python3-zipp

python3-paramiko

python3-secretstorage

python3-systemd

foomatic-db-compressed-ppds

libwacom-bin

update-notifier-common

python3-debian

参考文章

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。