안녕하세요, 저는 Debian Stretch를 사용하는 새로운 Linux 초보입니다. 패키지를 설치하거나 제거하려고 하면 오류가 발생합니다.
다음을 사용하여 패키지를 설치하려고 할 때 발생하는 오류는 다음과 같습니다 pip3
.
dsal3389@Dsal3389:~$ pip3 install django
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f90b31f3740 (most recent call first):
Aborted
python3
그래서 나중에 제거하고 설치하려고 했더니 다음 오류가 발생했습니다.
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 <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
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
이것이 방금 일어난 일입니다. 내 컴퓨터를 열고 그런 것들을 얻으세요.
파이썬 버전:
dsal3389@Dsal3389:~$ python3 -V
Python 3.5.3
답변1
포장에 python3-pip
결함이 있어 손상될 수 있습니다 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)
Python2.7을 기본값으로 설정합니다.
python*을 다음에 추가하십시오 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
Python2.7로 전환합니다.
update-alternatives --config python
Python2.7을 선택합니다.
python3-pip
포장 만 제거하세요 .
dpkg --configure -a
apt purge python3-pip
Python3을 유지할 수 있습니다.
apt --reinstall install python3
설치 apt-listbugs
패키지는 지속적으로 추적되며 python3-pip
버그가 수정된 후에 설치할 수 있습니다.
편집하다
따르다이 답변아나운서@faheemmisha이 오류를 해결하려면:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]