debian9 não pode instalar pacotes python com o pip3 ou desinstalar pacotes com o apt

1

Olá, eu sou um grande noobie linux que usa o debian stretch Estou recebendo erros quando estou tentando instalar pacotes ou excluir pacotes

este é o erro que recebo quando tento instalar pacotes com o pip3

dsal3389@Dsal3389:~$ pip3 install django

Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings'

Current thread 0x00007f90b31f3740 (most recent call first): Aborted

então eu tentei apagar python3 e instalá-lo mais tarde, e então eu recebi este erro

dsal3389@Dsal3389:~$ sudo apt purge python3

Reading package lists... Done Building dependency tree
Reading state information... Done The following packages were automatically installed and are no longer required: diffstat distro-info-data espeak-ng-data gir1.2-accountsservice-1.0 gir1.2-atspi-2.0 gir1.2-caribou-1.0 gir1.2-gck-1 gir1.2-gcr-3 gir1.2-gdm-1.0 gir1.2-git2-glib-1.0 gir1.2-gmenu-3.0 gir1.2-gnomebluetooth-1.0 gir1.2-grilo-0.3 gir1.2-gtk-2.0 gir1.2-gucharmap-2.90 gir1.2-mediaart-2.0 gir1.2-mutter-3.0 gir1.2-networkmanager-1.0 gir1.2-nmgtk-1.0 gir1.2-packagekitglib-1.0 gir1.2-polkit-1.0 gir1.2-rb-3.0 gir1.2-totem-1.0 gir1.2-totem-plparser-1.0 gir1.2-upowerglib-1.0 gir1.2-vte-2.91 gir1.2-wnck-3.0 gir1.2-zeitgeist-2.0 gnome-session-bin gnome-session-common gnome-software-common hyphen-en-us icu-devtools libappstream-glib8 libapt-pkg-perl libbrlapi0.6 libc6-dev:i386 libcairo-script-interpreter2 libcaribou-common libcaribou0 libcgi-fast-perl libcgi-pm-perl libclass-accessor-perl libclone-perl libdotconf0 libemail-valid-perl libespeak-ng1 libexporter-tiny-perl libfcgi-perl libfontconfig1-dev libfreetype6-dev libfwupd1 libgcab-1.0-0 libgdm1 libgit2-24 libgit2-glib-1.0-0 libgnome-menu-3-0 libgpod-common libgpod4 libgraphite2-dev libgspell-1-1 libgspell-1-common libgucharmap-2-90-7 libharfbuzz-gobject0 libhttp-parser2.1 libice-dev libicu-dev libio-pty-perl libio-string-perl libipc-run-perl liblist-moreutils-perl liblouis-data liblouis12 libncursesw6 libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl libnm-gtk0 libparse-debianchangelog-perl libpcaudio0 libpcre3-dev libpcre32-3 libpcrecpp0v5 libperlio-gzip-perl libpixman-1-dev libpng-dev libpng-tools libpthread-stubs0-dev libpython3-dev libpython3-stdlib libpython3.5-dev libpython3.6-minimal libpython3.6-stdlib libreoffice-help-en-us libsgutils2-2 libsm-dev libsonic0 libspeechd2 libsub-name-perl libtext-levenshtein-perl libtinfo6 libx11-dev libx11-doc libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev libyaml-libyaml-perl lintian linux-libc-dev:i386 patchutils pkg-config python-openssl python-requests python-urllib3 python3-minimal python3.5-dev python3.6-minimal speech-dispatcher speech-dispatcher-audio-plugins speech-dispatcher-espeak-ng t1utils x11proto-composite-dev x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xinerama-dev xbrlapi xorg-sgml-doctools xtrans-dev xwayland zlib1g-dev Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: apt-listchanges* caribou* chrome-gnome-shell* dh-python* gdebi* gdebi-core* gdm3* gedit* gedit-common* gedit-plugins* gir1.2-ibus-1.0* gnome* gnome-core* gnome-menus* gnome-music* gnome-orca* gnome-session* gnome-shell* gnome-shell-extensions* gnome-software* libatk1.0-dev* libcairo2-dev* libgdk-pixbuf2.0-dev* libglib2.0-dev* libgtk2.0-dev* libharfbuzz-dev* libpango1.0-dev* libreoffice* libreoffice-librelogo* libreoffice-script-provider-python* libxfce4util-dev* lsb-release* python3* python3-apt* python3-brlapi* python3-cairo* python3-cffi-backend* python3-chardet* python3-crypto* python3-cryptography* python3-cups* python3-cupshelpers* python3-dbus* python3-debian* python3-debianbts* python3-dev* python3-gi* python3-gi-cairo* python3-httplib2* python3-idna* python3-keyring* python3-keyrings.alt* python3-louis* python3-mako* python3-markupsafe* python3-pip* python3-pkg-resources* python3-pyasn1* python3-pyatspi* python3-pycurl* python3-pysimplesoap* python3-reportbug* python3-requests* python3-secretstorage* python3-setuptools* python3-six* python3-smbc* python3-software-properties* python3-speechd* python3-uno* python3-urllib3* python3-wheel* python3-xdg* reportbug* rhythmbox-plugins* software-properties-common* software-properties-gtk* system-config-printer-common* system-config-printer-udev* task-gnome-desktop* totem-plugins* ufw* unattended-upgrades* unoconv* xfce4-panel-dev* 0 upgraded, 0 newly installed, 85 to remove and 0 not upgraded. After this operation, 118 MB disk space will be freed. Do you want to continue? [Y/n] y Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings'

Current thread 0x00007f04e1fbb740 (most recent call first): Aborted E: Sub-process /usr/bin/apt-listchanges --apt || test $? -lt 10 returned an >error code (1) E: Failure running script /usr/bin/apt-listchanges --apt || test $? -lt 10

isso aconteceu por minha vez, meu computador e conseguir essa equipe

Versão em Python

dsal3389@Dsal3389:~$ python3 -V

Python 3.5.3

    
por dsal3389 06.06.2018 / 16:48

1 resposta

0

O pacote python3-pip está com bugs e pode quebrar apt .

apt-listbugs list python3-pip
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
serious bugs of python3-pip (-> ) <Resolved in some Version>
b1 - #896390 - python3-pip: pip fails to import (Fixed: python-pip/9.0.1-2.1)
Summary:
 python3-pip(1 bug)

Defina o Python2.7 como padrão:

Adicione python * a update-alternatives :

update-alternatives --install /usr/bin/python python /usr/bin/python2.7 40
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 30

Mude para python2.7:

update-alternatives --config python

Selecione python2.7.

Remova apenas o pacote python3-pip .

dpkg --configure -a
apt purge python3-pip

Você pode manter o python3:

apt --reinstall install python3

Instale o pacote apt-listbugs para acompanhar o python3-pip , você pode instalá-lo depois que o bug for corrigido.

Editar

Siga esta resposta publicada por @ Faheem Mitha para resolver este erro:

Could not find platform independent libraries <prefix> 
Could not find platform dependent libraries <exec_prefix> 
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 
    
por 06.06.2018 / 16:54