ImportError: cannot import name ‘PackageFinder‘ from ‘pip._internal.index‘

问题出现

环境:ubuntu16.04 ,anacona3中的一个python2.7的环境,pip版本19.0.1
当时是为了install numpy,使用 conda 环境 python 对应的 pip(命令:pip uninsall numpy)

参考博客:https://blog.csdn.net/qq_43507878/article/details/104170781

报错如下

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自动升级到20.0版本失败,导致当前的构建操作失败了

解决方式

目前查资料得到两个方式,殊途同归,都是更换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

 

 
 
 
 

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