Ubuntu 及其对 Python 的依赖

Ubuntu 及其对 Python 的依赖

我意识到 Python 已嵌入到 Ubuntu 中。它自很久以前就已预装。但 Ubuntu 在多大程度上依赖 Python 才能正常运行?这取决于您使用的版本吗?可以在不安装任何 Python 的情况下使用 Ubuntu 吗?我们甚至可以称之为 Ubuntu 吗?它会只是 GNU/Linux 吗?

我问这个问题是因为我在尝试摆弄 Python 的分发安装时遇到了一些问题并且遇到了无数的问题,然后通过确保 Python 已正确安装和链接解决了这些问题。

抱歉,这是一个范围很广的问题。

答案1

许多必备软件包都依赖于与 Ubuntu 捆绑在一起的默认 Python 3.x 版本,包括桌面环境、终端和软件应用程序,如果您卸载这个 Python 包,那么所有已安装的软件都将无法工作,Ubuntu 将无法启动,只能进入虚拟控制台或恢复模式。

为了更详细地展示删除默认 Python 版本后会发生什么,以下是在我的 Ubuntu 22.04 中模拟删除 python3.10 的部分结果。 的完整输出apt remove --simulate python3.10太长了,需要三个单独的答案才能列出它。

$ apt remove --simulate python3.10
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  apg apport-symptoms aptdaemon-data avahi-utils binfmt-support blt
  calibre-bin cups-pk-helper dc dctrl-tools diffstat distro-info
  distro-info-data docbook-xml fonts-font-awesome fonts-glyphicons-halflings
  fonts-lyx fonts-mathjax gettext gir1.2-accountsservice-1.0 gir1.2-adw-1
  gir1.2-atspi-2.0 gir1.2-dbusmenu-glib-0.4 gir1.2-dee-1.0 gir1.2-gck-1
  gir1.2-gcr-3 gir1.2-gdm-1.0 gir1.2-geoclue-2.0 gir1.2-gnomebluetooth-3.0
  gir1.2-goa-1.0 gir1.2-graphene-1.0 gir1.2-gst-plugins-base-1.0
  gir1.2-gstreamer-1.0 gir1.2-gtk-4.0 gir1.2-gtksource-4 gir1.2-gudev-1.0
  gir1.2-gweather-3.0 gir1.2-ibus-1.0 gir1.2-javascriptcoregtk-4.0
  gir1.2-json-1.0 gir1.2-mutter-10 gir1.2-nm-1.0 gir1.2-nma-1.0
  gir1.2-notify-0.7 gir1.2-packagekitglib-1.0 gir1.2-polkit-1.0
  gir1.2-poppler-0.18 gir1.2-rb-3.0 gir1.2-rsvg-2.0 gir1.2-secret-1
  gir1.2-snapd-1 gir1.2-soup-2.4 gir1.2-totem-1.0 gir1.2-totemplparser-1.0
  gir1.2-udisks-2.0 gir1.2-unity-7.0 gir1.2-upowerglib-1.0 gir1.2-vte-2.91
  gir1.2-webkit2-4.0 gir1.2-wnck-3.0 gkbd-capplet gnome-bluetooth-3-common
  gnome-control-center-faces gnome-session-bin gnome-session-common
  gnome-shell-common gnome-startup-applications gnome-terminal-data
  gstreamer1.0-pipewire ibus-data ibus-gtk4 icu-devtools intltool-debian
  jupyter-nbextension-jupyter-js-widgets libaec0 libaliased-perl
  libapt-pkg-perl libarchive-zip-perl libarray-intspan-perl
  libb-hooks-endofscope-perl libb-hooks-op-check-perl libblosc1 libboost-dev
  libboost1.74-dev libcapture-tiny-perl libchm1 libclang-cpp11
  libclass-data-inheritable-perl libclass-method-modifiers-perl
  libclass-xsaccessor-perl libcmark-gfm-extensions0.29.0.gfm.3
  libcmark-gfm0.29.0.gfm.3 libcolord-gtk1 libconfig-tiny-perl
  libconst-fast-perl libcontextual-return-perl libcpanel-json-xs-perl
  libdata-dpath-perl libdata-messagepack-perl libdata-optlist-perl
  libdata-validate-domain-perl libdata-validate-ip-perl
  libdata-validate-uri-perl libdevel-callchecker-perl libdevel-size-perl
  libdevel-stacktrace-perl libdistro-info-perl libdmapsharing-3.0-2
  libdynaloader-functions-perl libemail-address-xs-perl
  libexception-class-perl libexpat1-dev libexporter-tiny-perl libffi-dev
  libfile-chdir-perl libfile-dirlist-perl libfile-find-rule-perl
  libfile-homedir-perl libfile-touch-perl libfile-which-perl libfont-ttf-perl
  libgit-wrapper-perl libgitlab-api-v4-perl libglu1-mesa
  libgnome-bluetooth-3.0-13 libgnomekbd-common libgnomekbd8 libgpod-common
  libgpod4 libgsound0 libgssdp-1.2-0 libgupnp-1.2-1 libgupnp-av-1.0-3
  libgupnp-dlna-2.0-4 libhash-fieldhash-perl libhdf5-103-1 libhpmud0
  libhtml-html5-entities-perl libhttp-tiny-multipart-perl libicu-dev
  libimagequant0 libimport-into-perl libio-interactive-perl
  libio-prompt-tiny-perl libio-prompter-perl libio-pty-perl libio-string-perl
  libipc-run-perl libipc-run3-perl libiterator-perl libiterator-util-perl
  libjpeg-turbo-progs libjs-backbone libjs-bootstrap libjs-bootstrap-tour
  libjs-codemirror libjs-es6-promise libjs-jed libjs-jquery-typeahead
  libjs-jquery-ui libjs-marked libjs-mathjax libjs-moment libjs-requirejs
  libjs-requirejs-text libjs-sphinxdoc libjs-text-encoding libjs-underscore
  libjs-xterm libjson-maybexs-perl liblbfgsb0 libldb2 liblist-compare-perl
  liblist-moreutils-perl liblist-moreutils-xs-perl liblist-someutils-perl
  liblist-someutils-xs-perl liblist-utilsby-perl libllvm11
  liblog-any-adapter-screen-perl liblog-any-perl libmarkdown2
  libmath-base85-perl libminizip1 libmodule-implementation-perl
  libmodule-runtime-perl libmoo-perl libmoox-aliases-perl libmoox-struct-perl
  libmouse-perl libmujs1 libnamespace-autoclean-perl libnamespace-clean-perl
  libncurses-dev libnet-domain-tld-perl libnet-ipv6addr-perl
  libnet-netmask-perl libnetaddr-ip-perl libnetplan0 libnumber-compare-perl
  libobject-id-perl libopenblas-dev libopenblas-pthread-dev libopenblas0
  libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl
  libparams-util-perl libpath-iterator-rule-perl libpath-tiny-perl
  libperlio-gzip-perl libperlio-utf8-strict-perl libpfm4 libpod-constants-perl
  libpod-parser-perl libpodofo0.9.7 libproc-processtable-perl libpython3-dev
  libpython3-stdlib libpython3.10-dev libqhull-r8.0 libqt5webengine-data
  libqt5webengine5 libqt5webenginecore5 libqt5webenginewidgets5 libraqm0
  libre-engine-re2-perl libre2-9 libreadonly-perl libref-util-perl
  libref-util-xs-perl libregexp-pattern-license-perl libregexp-pattern-perl
  librole-tiny-perl librsync2 librygel-core-2.6-2 librygel-db-2.6-2
  librygel-renderer-2.6-2 librygel-server-2.6-2 libsane-hpaio
  libsereal-decoder-perl libsereal-encoder-perl libserf-1-1
  libset-intspan-perl libsgutils2-2 libsixel1 libsort-versions-perl
  libstrictures-perl libstring-copyright-perl libstring-escape-perl
  libstring-shellquote-perl libsub-exporter-perl
  libsub-exporter-progressive-perl libsub-identify-perl libsub-install-perl
  libsub-quote-perl libsvn1 libsyntax-keyword-try-perl libsz2 libtalloc2
  libtbb12 libtbbmalloc2 libterm-readkey-perl libtevent0 libtext-engine-0.1-0
  libtext-glob-perl libtext-levenshteinxs-perl libtext-markdown-discount-perl
  libtext-xslate-perl libtime-duration-perl libtime-moment-perl libtinfo-dev
  libtk8.6 libtype-tiny-perl libtype-tiny-xs-perl libunicode-utf8-perl
  libutf8proc2 libvariable-magic-perl libwant-perl libwbclient0
  libwhoopsie-preferences0 libwnck-3-0 libwnck-3-common libxatracker2
  libxklavier16 libxml2-dev libxnvctrl0 libxres1 libxs-parse-keyword-perl
  libxsimd-dev libxvmc1 libyaml-libyaml-perl libyelp0 libz3-4 libz3-dev
  licensecheck lintian llvm-11 llvm-11-linker-tools llvm-11-runtime llvm-14
  llvm-14-runtime mobile-broadband-provider-info mpv mscompress
  network-manager-gnome node-jed numba-doc optipng pandoc pandoc-data
  patchutils pkg-config plymouth-label policykit-1-gnome power-profiles-daemon
  printer-driver-hpcups python-apt-common python-babel-localedata
  python-matplotlib-data python-odf-doc python-tables-data python3-minimal
  python3-pip-whl python3-setuptools-whl python3-wheel-whl python3.10-minimal
  rtmpdump rygel sgml-base sgml-data sphinx-rtd-theme-common
  switcheroo-control tk8.6-blt2.5 unicode-data vorbis-tools
  whoopsie-preferences x11-apps x11-session-utils xbrlapi xinit xinput
  xml-core xserver-xorg-input-all xserver-xorg-input-libinput
  xserver-xorg-input-wacom xserver-xorg-legacy xserver-xorg-video-all
  xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev
  xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware
  xwayland yelp-xsl zlib1g-dev
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  policykit-1-gnome
The following packages will be REMOVED:
  apport apport-gtk aptdaemon apturl apturl-common calibre chrome-gnome-shell
  clang-tidy clang-tidy-14 clang-tools-14 command-not-found cuetools deja-dup
  devscripts dput duplicity exfalso foomatic-db-compressed-ppds gdm3 gedit
  gedit-common gnome-control-center gnome-menus gnome-online-accounts
  gnome-shell gnome-shell-extension-appindicator
  gnome-shell-extension-desktop-icons-ng gnome-shell-extension-manager
  gnome-shell-extension-prefs gnome-shell-extension-ubuntu-dock
  gnome-shell-extensions gnome-terminal gnome-tweaks gnome-user-docs
  gvfs-backends hplip hplip-data ibus ibus-table ipython3 jupyter
  jupyter-client jupyter-console jupyter-core jupyter-nbconvert
  jupyter-nbformat jupyter-notebook language-selector-common
  language-selector-gnome libsmbclient libwacom-bin llvm-11-dev llvm-11-tools
  llvm-14-dev llvm-14-tools lsb-release mercurial mercurial-common
  nautilus-extension-gnome-terminal nautilus-share netplan.io
  networkd-dispatcher nvidia-prime nvidia-settings openprinting-ppds orca
  pdfarranger plymouth-theme-spinner plymouth-theme-ubuntu-text
  printer-driver-foo2zjs printer-driver-foo2zjs-common printer-driver-m2300w
  printer-driver-postscript-hp printer-driver-ptouch printer-driver-pxljr
  printer-driver-sag-gdi pyflakes3 pylint python-odf-tools python3
  python3-appdirs python3-apport python3-apsw python3-apt python3-aptdaemon
  python3-aptdaemon.gtk3widgets python3-argon2 python3-astroid python3-attr
  python3-autopep8 python3-babel python3-backcall python3-bcrypt
  python3-beniget python3-bleach python3-blinker python3-bottleneck
  python3-brlapi python3-brotli python3-bs4 python3-cairo python3-certifi
  python3-cffi-backend python3-chardet python3-chm python3-click
  python3-colorama python3-commandnotfound python3-cryptography
  python3-css-parser python3-cssselect python3-cssutils python3-cups
  python3-cupshelpers python3-cycler python3-dateutil python3-dbus
  python3-debconf python3-debian python3-decorator python3-defer
  python3-defusedxml python3-dev python3-distlib python3-distro
  python3-distro-info python3-distupgrade python3-distutils python3-dnspython
  python3-entrypoints python3-et-xmlfile python3-fasteners python3-feedparser
  python3-filelock python3-fonttools python3-fs python3-future python3-gast
  python3-gdbm python3-gi python3-gi-cairo python3-gpg python3-greenlet
  python3-html2text python3-html5-parser python3-html5lib python3-httplib2
  python3-ibus-1.0 python3-idna python3-ifaddr python3-img2pdf
  python3-importlib-metadata python3-iniconfig python3-ipykernel
  python3-ipython python3-ipython-genutils python3-ipywidgets python3-isort
  python3-jdcal python3-jedi python3-jeepney python3-jinja2 python3-jsonschema
  python3-jupyter-client python3-jupyter-console python3-jupyter-core
  python3-jupyterlab-pygments python3-jwt python3-keyring python3-kiwisolver
  python3-launchpadlib python3-lazr.restfulclient python3-lazr.uri
  python3-lazy-object-proxy python3-ldb python3-lib2to3 python3-llvmlite
  python3-lockfile python3-logilab-common python3-louis python3-lxml
  python3-lz4 python3-macaroonbakery python3-magic python3-mako
  python3-markdown python3-markupsafe python3-matplotlib
  python3-matplotlib-inline python3-mccabe python3-mechanize python3-monotonic
  python3-more-itertools python3-mpmath python3-msgpack python3-musicbrainzngs
  python3-mutagen python3-mypy-extensions python3-nacl python3-nbclient
  python3-nbconvert python3-nbformat python3-neovim python3-nest-asyncio
  python3-netifaces python3-notebook python3-numba python3-numexpr
  python3-numpy python3-oauthlib python3-odf python3-olefile python3-openpyxl
  python3-packaging python3-pandas python3-pandas-lib python3-pandocfilters
  python3-paramiko python3-parso python3-patsy python3-pbr python3-pep8
  python3-pexpect python3-pickleshare python3-pikepdf python3-pil
  python3-pil.imagetk python3-pip python3-pkg-resources python3-platformdirs
  python3-plotly python3-pluggy python3-ply python3-problem-report
  python3-prometheus-client python3-prompt-toolkit python3-protobuf
  python3-ptyprocess python3-py python3-py7zr python3-pyatspi
  python3-pycodestyle python3-pycryptodome python3-pydocstyle python3-pyflakes
  python3-pygments python3-pylsp python3-pylsp-jsonrpc python3-pymacaroons
  python3-pynvim python3-pyparsing python3-pyqt5 python3-pyqt5.qtsvg
  python3-pyqt5.qtwebchannel python3-pyqt5.qtwebengine python3-pyqt5.sip
  python3-pyrsistent python3-pytest python3-pythran python3-pyxattr
  python3-regex python3-renderpm python3-reportlab python3-reportlab-accel
  python3-repoze.lru python3-requests python3-requests-toolbelt
  python3-rfc3339 python3-rope python3-routes python3-scipy python3-seaborn
  python3-secretstorage python3-send2trash python3-setuptools
  python3-sgmllib3k python3-six python3-snowballstemmer python3-socks
  python3-software-properties python3-soupsieve python3-speechd python3-svn
  python3-sympy python3-systemd python3-tables python3-tables-lib
  python3-talloc python3-tenacity python3-terminado python3-testpath
  python3-texttable python3-tk python3-toml python3-tornado python3-traitlets
  python3-typing-extensions python3-tz python3-ufolib2 python3-ujson
  python3-unicodedata2 python3-unidiff python3-uno python3-update-manager
  python3-urllib3 python3-virtualenv python3-wadllib python3-wcwidth
  python3-webencodings python3-webob python3-wheel python3-widgetsnbextension
  python3-wrapt python3-xdg python3-xkit python3-xlwt python3-yaml
  python3-yapf python3-zeroconf python3-zipp python3-zmq python3.10
  python3.10-dev rhythmbox-plugin-alternative-toolbar rhythmbox-plugins
  samba-libs screen-resolution-extra software-properties-common
  software-properties-gtk system-config-printer system-config-printer-common
  system-config-printer-udev totem-plugins ubuntu-advantage-desktop-daemon
  ubuntu-advantage-tools ubuntu-desktop ubuntu-desktop-minimal ubuntu-docs
  ubuntu-drivers-common ubuntu-minimal ubuntu-release-upgrader-core
  ubuntu-release-upgrader-gtk ubuntu-session ufw unattended-upgrades
  update-manager update-manager-core update-notifier update-notifier-common
  usb-creator-common usb-creator-gtk virtualenv vlc-plugin-samba xorg
  xserver-xorg yelp youtube-dl
The following NEW packages will be installed:
  policykit-1-gnome
0 upgraded, 1 newly installed, 357 to remove and 0 not upgraded.

答案2

简短的回答:不,没有办法。

较长的答案:并非不可能,但这样做会让您付出很大努力来避免 Python 依赖。您应该使用 Debian,因为它对 Python 的依赖较少。

要查看哪些内容依赖于 python,您可以使用apt-rdepends。首先,ubuntu-minimal需要python3。此外,您必须重新配置功能netplan.iolsb-release, 和ubuntu-drivers-common做过。

相关内容