解决PIP的导入错误:无法从PIP导入名称“packagefinder”。_内部。索引’(XXXX),pip,ImportErrorcannotimportnamePackageFinderfrompipinternalindexxxxx
2020-02-07 from–https://www.pythonf.cn/read/1421

问题出现

环境 :ubuntu16.04 ,anacona中的一个py37的环境,pip版本20.0.1
当时是为了install fbs,使用conda环境python对应的pip

报错如下:
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/home/yushan/anaconda3/lib/python3.7/site-packages/pip/_internal/index/__init__.py)

原因

stack overflow 上的说法:
Currently all builds are failing because the automatic upgrade (since #4823 ) to pip 20.0 was buggy (see pypa/pip#7620 ).

解决方式

目前查资料得到两个方式,殊途同归,都是更换pip版本

一、

The fix is to wipe out the build environment as follows (this is taken from https://docs.readthedocs.io/en/stable/guides/wipe-environment.html):

Log in to read-the-docs
Go to Versions
Click on the Edit button of the version you want to wipe on the right side of the page
Go to the bottom of the page and click the wipe link, next to the “Save” button
Now you can re-build the version with a fresh build environment
参考:https://stackoverflow.com/questions/59846065/read-the-docs-build-fails-with-cannot-import-name-packagefinder-from-pip-in

二、

直接更新

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
上一篇
下一篇