解决pip的ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (xxxx)

问题出现

环境: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

参考:https://blog.csdn.net/tz_zs/article/details/87939977

你可能感兴趣的:(解决pip的ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (xxxx))