debian9无法使用pip3安装python软件包或使用apt卸载软件包

dsal3389

你好,我是一个大的Linux noobie,在尝试安装软件包或删除软件包时,使用debian Stretch会出现错误

这是我尝试使用pip3安装软件包时遇到的错误

dsal3389 @ Dsal3389:〜$ pip3安装Django

找不到平台独立的库找不到平台独立的库考虑将$ PYTHONHOME设置为[:]致命Python错误:Py_Initialize:无法获取区域设置编码ImportError:没有名为“ encodings”的模块

当前线程0x00007f90b31f3740(最近调用优先):已中止

所以我尝试删除python3并稍后安装,然后出现此错误

dsal3389 @ Dsal3389:〜$ sudo apt清除python3

正在读取包列表...完成构建依赖关系树
i386 patchutils pkg-config python-openssl python-requests python-urllib3 python3-minimum python3.5-dev python3.6-minimum 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使用'sudo apt autoremove'删除它们。将删除以下软件包:apt-listchanges *驯鹿* 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。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 *软件属性-gtk * system-config-printer-common * system-config-printer-udev * task-gnome-desktop *图腾插件* ufw *无人值守升级* unoconv * xfce4-panel-dev * 0升级,新安装了0个,删除了85个,还有0个未升级。此操作后,将释放118 MB磁盘空间。你要继续吗?[Y / n] y找不到平台独立的库找不到平台依赖的库考虑将$ PYTHONHOME设置为[:]致命Python错误:Py_Initialize:无法获取语言环境编码ImportError:没有名为“ encodings”的模块

当前线程0x00007f04e1fbb740(最近调用优先):中止E:子进程/ usr / bin / apt-listchanges --apt || 测试$?-lt 10返回>错误代码(1)E:运行脚本/ usr / bin / apt-listchanges --apt ||失败 测试$?-lt 10

刚发生这种情况,请打开我的电脑,并请那些工作人员

Python版本

dsal3389 @ Dsal3389:〜$ python3 -V

的Python 3.5.3

GAD3R

该程序包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,您可以在错误修复后进行安装。

编辑

请按照@Faheem Mitha发布的答案来解决此错误:

Could not find platform independent libraries <prefix> 
Could not find platform dependent libraries <exec_prefix> 
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章