AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-2200181

TheShanachie's questions

Martin Hope
TheShanachie
Asked: 2025-04-08 07:48:34 +0800 CST

Instalação do Python quebrada para WSL2 no Windows 11

  • 5

Na tentativa de limpar o sistema de arquivos no WSL2, desinstalei o python3 via

 sudo rm -rf /usr/bin/python3
 sudo rm -rf /usr/lib/python3
 sudo rm -rf /usr/local/lib/python3 

Por outro lado, estou com dificuldades para reinstalar e usar o python3.* através do WSL. Ao tentar reinstalar o python3 através do sudo apt-get install --reinstall python3, recebi algo semelhante ao seguinte erro.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  htop libnl-3-200 libnl-genl-3-200 libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python-pkg-resources python-setuptools python2 python2-minimal python2.7 python2.7-minimal
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 22 not upgraded.
40 not fully installed or removed.
Need to get 0 B/22.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 99157 files and directories currently installed.)
Preparing to unpack .../python3_3.10.6-1~22.04.1_amd64.deb ...
/var/lib/dpkg/info/python3.prerm: 5: py3clean: not found
dpkg: warning: old python3 package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 5: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/python3_3.10.6-1~22.04.1_amd64.deb (--unpack):
 new python3 package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/python3.postinst: 47: py3compile: not found
dpkg: error while cleaning up:
 installed python3 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/python3_3.10.6-1~22.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Isso me levou a várias armadilhas, onde eu não estava preparado para entender. Repeti o comando a seguir em uma ordem semelhante, antes de perceber que poderia ter criado um problema muito maior...

sudo apt purge python3
------
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apport-symptoms bc blt debhelper debugedit devhelp-common dh-autoreconf dh-strip-nondeterminism distro-info distro-info-data dwz eatmydata fdisk fonts-lyx gdisk gir1.2-atk-1.0 gir1.2-atspi-2.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0
  gir1.2-glib-2.0 gir1.2-gtk-2.0 gir1.2-gtk-3.0 gir1.2-harfbuzz-0.0 gir1.2-packagekitglib-1.0 gir1.2-pango-1.0 htop icu-devtools intltool-debian libappstream4 libarchive-cpio-perl libarchive-zip-perl libatk1.0-doc libblkid-dev
  libboost-dev libboost1.74-dev libbrotli-dev libcairo-script-interpreter2 libdatrie-dev libdbus-1-dev libdebhelper-perl libdeflate-dev libdevhelp-3-6 libeatmydata1 libegl-dev libegl1-mesa-dev libepoxy-dev libevent-core-2.1-7 libfdisk1
  libffi-dev libfile-stripnondeterminism-perl libfontconfig-dev libfontconfig1-dev libfreetype-dev libfreetype6-dev libfribidi-dev libgail-common libgail18 libgl-dev libgles-dev libgles1 libglib2.0-bin libglib2.0-doc libglvnd-core-dev
  libglvnd-dev libglx-dev libgraphite2-dev libgtk-3-doc libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz-gobject0 libice-dev libicu-dev libimagequant0 libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjs-jquery
  libjs-jquery-ui libjs-sphinxdoc libjs-underscore liblbfgsb0 liblzma-dev libmail-sendmail-perl libmount-dev libncurses-dev libnetplan0 libnl-3-200 libnl-genl-3-200 libopengl-dev libopengl0 libopenjp2-7 libpackagekit-glib2-18
  libpango1.0-doc libpangoxft-1.0-0 libpcre16-3 libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpfm4 libpixman-1-dev libpng-dev libpng-tools libpython2-stdlib libpython2.7-minimal
  libpython2.7-stdlib libpython3-stdlib libqhull-r8.0 libraqm0 libselinux1-dev libsepol-dev libsm-dev libstemmer0d libsub-override-perl libsys-hostname-long-perl libtcl8.6 libthai-dev libtiff-dev libtiffxx5 libtinfo-dev libtk8.6
  libutempter0 libwayland-bin libwayland-dev libxcb-render0-dev libxcb-shm0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxkbcommon-dev libxml2-dev libxml2-utils libxmlb2
  libxrandr-dev libxrender-dev libxsimd-dev libxtst-dev libyaml-0-2 libz3-4 libz3-dev llvm-14 llvm-14-runtime packagekit packagekit-tools pango1.0-tools po-debconf python-apt-common python-babel-localedata python-matplotlib-data
  python-pkg-resources python-setuptools python2 python2-minimal python2.7 python2.7-minimal python3-minimal python3-pip-whl python3-setuptools-whl python3.10 python3.10-dev python3.10-minimal run-one screen tk8.6-blt2.5 tmux
  unicode-data uuid-dev wayland-protocols
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  apport* byobu* cloud-guest-utils* cloud-init* command-not-found* devhelp* landscape-client* landscape-common* libatk-bridge2.0-dev* libatk1.0-dev* libatspi2.0-dev* libcairo2-dev* libgdk-pixbuf-2.0-dev* libglib2.0-dev*
  libglib2.0-dev-bin* libgtk-3-dev* libgtk2.0-dev* libharfbuzz-dev* libpango1.0-dev* llvm-14-dev* llvm-14-tools* lsb-release* netplan.io* networkd-dispatcher* pastebinit* plymouth-theme-ubuntu-text* python3* python3-appdirs*
  python3-apport* python3-apt* python3-attr* python3-automat* python3-babel* python3-backcall* python3-bcrypt* python3-beniget* python3-blinker* python3-brotli* python3-bs4* python3-certifi* python3-cffi-backend* python3-chardet*
  python3-click* python3-colorama* python3-commandnotfound* python3-configobj* python3-constantly* python3-cryptography* python3-cycler* python3-dateutil* python3-dbus* python3-debconf* python3-decorator* python3-dev* python3-distro*
  python3-distro-info* python3-distupgrade* python3-distutils* python3-fonttools* python3-fs* python3-gast* python3-gdbm* python3-gi* python3-hamcrest* python3-html5lib* python3-httplib2* python3-hyperlink* python3-idna*
  python3-importlib-metadata* python3-incremental* python3-ipython* python3-jedi* python3-jeepney* python3-jinja2* python3-json-pointer* python3-jsonpatch* python3-jsonschema* python3-jwt* python3-keyring* python3-kiwisolver*
  python3-launchpadlib* python3-lazr.restfulclient* python3-lazr.uri* python3-lib2to3* python3-lxml* python3-lz4* python3-markupsafe* python3-matplotlib* python3-matplotlib-inline* python3-more-itertools* python3-mpmath*
  python3-netifaces* python3-newt* python3-numpy* python3-oauthlib* python3-olefile* python3-openssl* python3-packaging* python3-parso* python3-pexpect* python3-pickleshare* python3-pil* python3-pil.imagetk* python3-pip*
  python3-pkg-resources* python3-ply* python3-problem-report* python3-prompt-toolkit* python3-ptyprocess* python3-pyasn1* python3-pyasn1-modules* python3-pycurl* python3-pygments* python3-pyparsing* python3-pyrsistent* python3-pythran*
  python3-requests* python3-scipy* python3-secretstorage* python3-serial* python3-service-identity* python3-setuptools* python3-six* python3-software-properties* python3-soupsieve* python3-sympy* python3-systemd* python3-tk*
  python3-traitlets* python3-twisted* python3-tz* python3-ufolib2* python3-unicodedata2* python3-update-manager* python3-urllib3* python3-venv* python3-wadllib* python3-wcwidth* python3-webencodings* python3-wheel* python3-yaml*
  python3-zipp* python3-zope.interface* python3.10-venv* python3.11-venv* software-properties-common* ubuntu-advantage-tools* ubuntu-minimal* ubuntu-pro-client* ubuntu-pro-client-l10n* ubuntu-release-upgrader-core* ubuntu-wsl* ufw*
  unattended-upgrades* update-manager-core*
0 upgraded, 0 newly installed, 155 to remove and 21 not upgraded.
40 not fully installed or removed.
After this operation, 548 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 99157 files and directories currently installed.)
Removing cloud-init (24.4.1-0ubuntu0~22.04.1) ...
/var/lib/dpkg/info/cloud-init.prerm: 21: py3clean: not found
dpkg: error processing package cloud-init (--remove):
 installed cloud-init package pre-removal script subprocess returned error exit status 127
dpkg: too many errors, stopping
/var/lib/dpkg/info/cloud-init.postinst: 423: py3compile: not found
dpkg: error while cleaning up:
 installed cloud-init package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 cloud-init
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Tenho tentado entender isso há muito mais tempo do que gostaria de admitir. Existem também alguns tópicos sobre o assunto; no entanto, as conversas não têm sido suficientes para me ajudar.

  1. tentando desinstalar o python3
  2. tentando ver problemas semelhantes
  3. um tópico semelhante

EDIT: Me perguntaram qual é a minha versão do Ubuntu. Gostaria de saber como posso encontrar isso de outra forma, mas usar lsb_release -adá o seguinte erro.

-bash: /usr/bin/lsb_release: /usr/bin/python3: bad interpreter: No such file or directory
apt
  • 1 respostas
  • 20 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve