文章目录
注意事项当前的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.102. 去 /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-configii python-is-python3 3.9.2-2 all symlinks /usr/bin/python to python3ii python3-apt 2.4.0ubuntu1 amd64 Python 3 interface to libapt-pkgii python3-blinker 1.4+dfsg1-0.4 all fast, simple object-to-object and broadcast signaling libraryii python3-cffi-backend:amd64 1.15.0-1build2 amd64 Foreign Function Interface for Python 3 calling C code - runtimeii 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 systemii 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 APIii 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 librariesii python3-httplib2 0.20.2-2 all comprehensive HTTP client library written for Python3ii python3-importlib-metadata 4.6.4-1 all library to access the metadata for a Python package - Python 3.xii python3-jeepney 0.7.1-3 all pure Python D-Bus interfaceii python3-jwt 2.3.0-1ubuntu0.2 all Python 3 implementation of JSON Web Tokenii python3-keyring 23.5.0-1 all store and access your passwords safelyii 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 URIsii 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 Python3ii python3-pkg-resources 59.6.0-1.2ubuntu0.22.04.1 all Package Discovery and Resource Access using pkg_resourcesii python3-pyparsing 2.4.7-1 all alternative to creating and executing simple grammars - Python 3.xii python3-secretstorage 3.3.1-1 all Python module for storing secrets - Python 3.x versionii 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 fromrc python3-uno 1:7.3.6-0ubuntu0.22.04.2 amd64 Python-UNO bridgeii python3-wadllib 1.3.6-1 all Python 3 library for navigating WADL filesii python3-zipp 1.0.0-3 all pathlib-compatible Zipfile object wrapper - Python 3.x
python 3.8 安装
sudo apt install software-properties-commonsudo 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-commonsudo echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/backports.listsudo apt updatesudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY>// sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553sudo apt update
// 安装python3.8sudo 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 -> python3lrwxrwxrwx 1 root root 18 6月 11 15:30 /usr/bin/python3 -> /usr/bin/python3.8lrwxrwxrwx 1 root root 25 6月 11 16:18 /usr/bin/python3-config -> /usr/bin/python3.8-configlrwxrwxrwx 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 -> python3lrwxrwxrwx 1 root root 18 6月 11 15:30 /usr/bin/python3 -> /usr/bin/python3.10lrwxrwxrwx 1 root root 25 6月 11 16:18 /usr/bin/python3-config -> /usr/bin/python3.10-configlrwxrwxrwx 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 10sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.10-config 10sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 8sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.8-config 8
sudo update-alternatives --config python3sudo update-alternatives --config python3-config
ubuntu22.04 卸载 python3.10 包时卸载的所有包
lsb-releasepython3-blinkerorcanetworkd-dispatcherlibglib2.0-dev-binprinter-driver-m2300wssh-import-idpython3.10python3-coloramapython3-gipython3-tzgnome-user-docslibatk-bridge2.0-devnautilus-extension-gnome-terminalpython3-sambapython3-distupgradepython3-brlapiupdate-managerpython3-dnspythonpython3-dateutildnfprinter-driver-foo2zjs-commongypusb-creator-commonlibglib2.0-devpython3-monotonicpython3-cffi-backendnpmsamba-vfs-modulesapport-gtkpython3-lib2to3ibus-tableufwpython3-lazr.restfulclientlibgtk2.0-devpython3-lockfilepython3-ibus-1.0deja-dupapturl-commonpython3-jeepneyubuntu-drivers-commonpython3-ptyprocessubuntu-release-upgrader-gtkusb-creator-gtktrash-clipython3-reportlab-accelpython3-distropython3-pymacaroonsubuntu-advantage-desktop-daemonpython3-deferplymouth-theme-spinnerlibatspi2.0-devpython3-reportlablanguage-selector-gnomesoftware-properties-commonnfs-commonsambarhythmbox-pluginspython3-requestsaptdaemonopenprinting-ppdspython3-importlib-metadatapython3-speechdplymouth-theme-ubuntu-textpython3-httplib2python3system-config-printer-udevpython3-urllib3python3-aptdaemonxserver-xorggedit-commonpython3-software-propertieslibsmbclientpython3-pyparsingpython3-lazr.urignome-shellpython3-more-itertoolssamba-dsdb-modulespython3-macaroonbakerypython3-wheelnfs-kernel-serversamba-common-binpython3-louispython3-pkg-resourcespython3-wadllibpython3-unboundpython3-gdbmlanguage-selector-commonsystem-config-printer-commonpython3-libdnfpython3-tallocprinter-driver-foo2zjsubuntu-desktopgdm3python3-pexpecttotem-pluginsgnome-shell-extension-desktop-icons-ngpython3-oauthlibnode-gyppython3-pyatspignome-shell-extension-appindicatorprinter-driver-postscript-hpupdate-notifierpython3-makopython3-cairoduplicityprinter-driver-pxljrpython3-clicklibatk1.0-devlibgdk-pixbuf-2.0-devgvfs-backendsupdate-manager-corepython3-xkitpython3-fastenerspython3-aptsoftware-properties-gtkgnome-online-accountsgeditpython3-devpython3-dnfpython3-netifacesprinter-driver-ptouchpython3-certifipython3-renderpmpython3-gpgxorgpython3-markupsafepython3-distro-infopython3-jwtubuntu-sessionpython3-ldbpython3-libcompssystem-config-printerpython3-pilpython3-pipsconshplippython3-rpmpython3-protobufpython3-sixgnome-menuspython3-tdbpython3-markdownprinter-driver-sag-gdiapturlpython3-unopython3-naclpython3.10-devubuntu-docspython3-xdgpython3-yamlrhythmbox-plugin-alternative-toolbargnome-shell-extension-ubuntu-docksamba-libsgnome-control-centerubuntu-desktop-minimalpython3-update-manageryelpnetplan.iopython3-distutilspython3-apportpython3-keyringpython3-commandnotfoundpython3-rfc3339hplip-datapython3-aptdaemon.gtk3widgetsnautilus-sharepython3-cupspython3-idnapython3-olefilegnome-terminalpython3-pygmentsibuslibgtk-3-devpython3-bcryptpython3-chardetunattended-upgradeslibcairo2-devpython3-debconfpython3-setuptoolsubuntu-release-upgrader-corecommand-not-foundpython3-cryptographyubuntu-advantage-toolspython3-launchpadlibpython3-hawkeypython3-dbuspython3-requests-toolbeltlibharfbuzz-devlibpango1.0-devpython3-problem-reportpython3-cupshelperspython3-futurepython3-gi-cairoapportpython3-zipppython3-paramikopython3-secretstoragepython3-systemdfoomatic-db-compressed-ppdslibwacom-binupdate-notifier-commonpython3-debian