栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

pip3安装失败问题

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pip3安装失败问题

前言

执行pip3 install requests 报错如下:

Could not fetch URL https://mirrors.aliyun.com/pypi/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='mirrors.aliyun.com', port=443): Max retries exceeded with url: /pypi/simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
1、原因和快捷解决 原因

我们的pip3是源自于python3环境,而我们的pip3的下载源配置的是阿里云的镜像,不能正常从阿里云获得源文件。

快捷解决

换一个下载源

语法:
pip3 install requests -i + 指定的镜像源

例如:
使用豆瓣镜像源加速

pip3 install requests -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
彻底解决办法

我们每次下载的时候都重新指定源太麻烦,我们更改pip3的配置文件。

linux下 :

mkdir  ~/.pip
vi  ~/.pip/pip.conf
添加内容如下:
 [global]
 index-url = https://pypi.tuna.tsinghua.edu.cn/simple

windows下
直接在user目录中创建一个pip目录,如:C:Usersxxpip,新建文件pip.ini,内容如下

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

2、常用的镜像源
pypi 清华大学源:https://pypi.tuna.tsinghua.edu.cn/simple
pypi 豆瓣源 :http://pypi.douban.com/simple/
pypi 腾讯源:http://mirrors.cloud.tencent.com/pypi/simple
pypi 阿里源:https://mirrors.aliyun.com/pypi/
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/951609.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号