【问题标题】:“Unable to locate finder for 'pip._vendor.distlib'” error when using "pip install virtualenv"使用“pip install virtualenv”时出现“无法找到 'pip._vendor.distlib' 的查找器”错误
【发布时间】:2017-02-15 22:21:18
【问题描述】:

我正在尝试在 Windows 10 下使用 Python 3.6 版本安装 virtualenv。当我运行“pip install virtualenv”时出现此错误。我是 Python 的新手。

Collecting virtualenv
  Downloading virtualenv-15.0.3-py2.py3-none-any.whl (3.5MB)
    100% |████████████████████████████████| 3.5MB 256kB/s
Installing collected packages: virtualenv
Exception:
Traceback (most recent call last):
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 742, in install
    **kwargs
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\wheel.py", line 493, in move_wheel_files
    maker.make_multiple(['%s = %s' % kv for kv in console.items()])
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\scripts.py", line 383, in make_multiple
    filenames.extend(self.make(specification, options))
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\scripts.py", line 372, in make
    self._make_script(entry, filenames, options=options)
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\scripts.py", line 276, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\scripts.py", line 212, in _write_script
    launcher = self._get_launcher('t')
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\scripts.py", line 351, in _get_launcher
    result = finder(distlib_package).find(name).bytes
  File "c:\users\corey shaw\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\distlib\resources.py", line 324, in finder
    raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'

【问题讨论】:

  • 是的,我也有同样的问题,似乎 pip+python3.6 组合出现了问题。让我们希望它在最终发布之前得到修复
  • 看起来最终版本已经发布,而且还没有修复。 :(

标签: python python-3.x pip virtualenv


【解决方案1】:

因为Windows now ships with curl by default,这个单行工作:

pip uninstall pip setuptools && curl -s https://bootstrap.pypa.io/get-pip.py | python

【讨论】:

    【解决方案2】:

    我将在这里添加对我有用的解决方案,以防有人无法使用上述方法解决他们的问题。打开 TerminalCommand promptAnaconda prompt 并按照 3 个步骤操作:

    第 1 步
    输入python -m pip uninstall pip

    第 2 步
    python -m ensurepip

    第三步
    python -m pip install -U pip

    可以使用pip --version 轻松检查 pip 版本。希望这对你有用:)

    【讨论】:

    • 为我工作。 +1 用于提供简单的脚本化和复制粘贴命令,无需显式下载任何其他脚本/工具。
    • 这对我有用!只有我用@Skyguard 的第 1 步替换了第 1 步所以我做了 1) python -m pip uninstall pip setuptools 2) python -m ensurepip 3) python -m pip install -U pip 和它都是可靠的谢谢你
    • 也为我工作!
    【解决方案3】:

    这对我有用:

    easy_install --upgrade pip

    Windows 10、Python 3.6

    【讨论】:

    • 也为我工作
    • 很好的简单解决方案,但很高兴知道为什么会这样,我认为@jjisnow 找到了。
    • 对于那些找不到完整路径的人来说,就像这样一个窗口:c:\Python38\Scripts\easy_install.exe --upgrade pip
    • 这仍然适用于 python 3.9,但警告说它将在未来的版本中被弃用。
    【解决方案4】:
    1. 卸载当前 pip:

      python -m pip uninstall pip setuptools
      
    2. https://bootstrap.pypa.io/get-pip.py下载get-pip.py

    3. 执行 get-pip 脚本:

      python get-pip.py
      

    【讨论】:

    • 它对我有用,也许是 windows python 或 pip 有问题
    【解决方案5】:

    尝试卸载 pip 并安装 get-pip.py。它似乎是 Windows 3.6 版本中的一个错误。 https://github.com/pypa/pip/issues/3964

    这里也有报道。 pip install jupyter: "Unable to locate finder for 'pip._vendor.distlib'"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-18
      • 1970-01-01
      • 2018-10-29
      • 2017-09-12
      • 2016-05-13
      • 1970-01-01
      • 2022-08-18
      相关资源
      最近更新 更多