一、背景
最近,在新的机器pip安装jieba包的时候,出现了下面的错误:"ERROR: Could not find a version that satisfies the requirement jieba (from versions: none) ERROR: No matching distribution found for jieba"。
二、解决过程
针对出现"ERROR: Could not find a version that satisfies the requirement XXX (from versions: none) ERROR: No matching distribution found for XXX 的问题,有以下常见的解法:
方法1:关闭VPN
关闭自己的翻墙的VPN,重试。很多人其实是因为用了VPN导致了网络不稳,关闭VPN后重试很可能就解决了。(本次首先关闭VPN重试,但依然没有解决)
方法2:更新自己的pip
在python的terminal下输入:pip install --upgrade pip。更新pip后重试。不过这个方法成功率一般比较低。(本次更新了自己的pip,重试了依然没有解决。)
方法3:选择使用国内的镜像源
这个方法成功率很高,一般能够解决常出现的问题。(使用该方案成功解决)
pip install 包的名称 -i 镜像的url --trusted-host 镜像的host
示例: pip install jieba -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
三、国内常用镜像源
本人列举了相关的国内常用的镜像源,以及对应的优缺点,供大家自行选择使用。
镜像源名称 | URL | 备注 |
清华大学镜像源 | https://pypi.tuna.tsinghua.edu.cn/simple/ | 完全度和速度都很好,是一个优秀的pip镜像源 |
阿里云镜像源 | https://mirrors.aliyun.com/pypi/simple/ | 完全度和速度也很好,是一个不错的选择 |
网易镜像源 | https://mirrors.163.com/pypi/simple/ | 速度比较快,但是完全度有限 |
豆瓣镜像源 | https://pypi.douban.com/simple/ | 速度较快,但是完全度也有限 |
百度云镜像源 | https://mirror.baidu.com/pypi/simple/ | 速度较快,但是完全度也有限 |
中科大镜像源 | https://pypi.mirrors.ustc.edu.cn/simple/ | 速度较快,但完全度不如前面几个镜像源 |
华为云镜像源 | https://mirrors.huaweicloud.com/repository/pypi/simple/ | 完全度和速度均中等 |
腾讯云镜像源 | https://mirrors.cloud.tencent.com/pypi/simple/ | 速度一般,完全度也一般 |