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

 

 
 
 
 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值