首页 > 解决方案 > 在 python3 上安装 socketio 模块似乎正在破坏 pip

问题描述

在使用 为 python 安装 socketio 包时pip3 install socketio,我得到了以下结果:

ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.

WARNING: The scripts easy_install and easy_install-3.8 are installed in '/home/bill/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed netifaces-0.10.6 setuptools-3.3 socketio-0.2.1

虽然我能够import socketio成功,但 pip3 似乎已损坏(?)。具体来说,当尝试运行包括 pip3 在内的任何内容时,即使pip3在终端中单独运行,我也会收到相同的错误:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/<username>/.local/lib/python3.8/site-packages/pkg_resources.py", line 1479, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 144, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_pip3.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/pip3", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/<username>/.local/lib/python3.8/site-packages/pkg_resources.py", line 1479, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

我尝试重新安装 pip3 但没有帮助。我从 ubuntu 迁移到 mint 认为发行版有问题,但结果相同。当我尝试删除 python 并重新安装它时,我也损坏了 ubuntu,因为我无法使用 pip,但是,你知道他们说什么,生活和学习。编辑:没有使用 pip3:模块“importlib._bootstrap”没有属性“SourceFileLoader”对我有用。

我目前正在使用 linux mint 20,但我在 ubuntu 20.04 和 20.04.1 上遇到了同样的问题。

任何想法,将不胜感激!

标签: pythonlinuxpython-3.8

解决方案


也许你的意思是这个socketio?:https ://pypi.org/project/python-socketio

python3 -m pip install python-socketio

字面上命名为“socketio”的包似乎只是陈旧且不受支持1,而“python-socketio”似乎还活着并已开发2 3

为此,查看类似的软件包并注意域名仿冒等通常很有价值。通过 pip 安装软件包时!


推荐阅读