Pip错误-> ImportError:没有名为助手的模块

时间:2019-03-08 19:03:56

标签: python linux python-2.7 pip helper

当我尝试使用pip安装任何软件包时,出现错误。它显示"ImportError: No module named helpers"。我尝试使用pip安装辅助程序模块,但发生了相同的错误。我正在粘贴错误消息的输出。操作系统:Arch Linux。

pip2 install requests

错误

Traceback (most recent call last):
  File "/usr/bin/pip2", line 11, in <module>
    load_entry_point('pip==18.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
    from pip._internal.utils.ui import BAR_TYPES
  File "/usr/lib/python2.7/site-packages/pip/_internal/utils/ui.py", line 15, in <module>
    from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin
ImportError: No module named helpers

1 个答案:

答案 0 :(得分:2)

感谢大家的帮助。我找到了解决方案。当我升级到python 3.7时,点子坏了。 执行这些命令可以解决该问题。

rm -rf /usr/lib/python3.7/site-packages
python3.7 -m ensurepip
pip install --upgrade pip

Same也可以用于Python2,只需将3.7替换为2.7,将pip替换为pip2。