您好,我是一个使用 Debian Stretch 的大 linux noobie。我在尝试安装包或删除包时遇到错误。
这是我尝试安装软件包时遇到的错误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
包裹
python3-pip
有问题,可能会损坏apt
。将 Python2.7 设置为默认值:
将 python* 添加到
update-alternatives
:切换到python2.7:
选择python2.7。
仅删除
python3-pip
包装。你可以保留python3:
安装
apt-listbugs
包一直跟踪python3-pip
,bug修复后即可安装。编辑
按照@Faheem Mitha发布的这个答案来解决这个错误: