【Python】pip安装加速:使用国内镜像源
【Python】pip安装加速:使用国内镜像源
零、使用命令行设置
一、设置全局镜像源
随便使用下面任一命令即可
阿里云:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
豆瓣:
pip config set global.index-url https://pypi.douban.com/simple/
清华大学:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
二、遇到的问题,信任镜像源
最新版的pip要求必须使用https,如果源不是https协议的,会报如下错误:
WARNING: The repository located at ... is not a trusted or secure host and is being ignored.
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommen
d you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: Could not find a version that satisfies the requirement requests (from versions: none)
ERROR: No matching distribution found for requests
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommen
d you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
WARNING: There was an error checking the latest version of pip.
解决方案一:切换为https的源(推荐)
一般在链接中把http替换成https即可,或者找对应的https源。
解决方案二:临时信任
可以在命令行后加上--trusted-host参数,例如:
pip install -i http://mirrors.aliyun.com/pypi/simple/ 依赖参数 --trusted-host mirrors.aliyun.com
壹、使用文件设置
Windows上按Windows+R键打开运行,输入%userprofile%打开个人文件夹,在个人文件夹中新建.pip目录,在目录中新建文本文档并改名为pip.conf,写入如下内容:
阿里云(http)
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
阿里云(https)
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
其他的源也是类似的,把链接改一下即可:
- 豆瓣:https://pypi.douban.com/simple/
- 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
- 中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/
叁、参考文档
- 国内pip源提示“not a trusted or secure host”解决方案
- pip源提示“not a trusted or secure host” 解决
- 【Python】已完美解决:WARNING: The repository located at mirrors .aliyun.com is not a trusted or secure host
- pip使用国内镜像源(附加全局修改)
【Python】pip安装加速:使用国内镜像源的更多相关文章
- pip安装模块使用国内镜像源加速安装
今天在安装Python模块matplotlib的时候,一直安装不成功,老是提示“socket.timeout: The read operation timed out”或者“Read timed o ...
- pip安装超时,更换国内镜像源安装
pip安装超时问题 pip install --index 源地址 安装包 常用镜像源地址: http://pypi.douban.com/ 豆瓣 http://pypi.mirrors.ustc.e ...
- Python中使用pip安装库时指定镜像源为豆瓣镜像源
场景 在使用pip进行安装库时,使用默认的库会很慢,甚至有时会出现远程主机中断了一个现有连接. 怎样在使用pip install 时指定镜像源为豆瓣镜像源. 实现 pip install moviep ...
- pip 安装包 使用国内镜像源
1.pipy国内镜像目前有: 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn ...
- 修改apt,pip,npm为国内镜像源
apt 原文件备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 编辑源列表文件 sudo vim /etc/apt/sources. ...
- 如何将python下载源地址修改为国内镜像源
(1)在 C:\Users\xxx 下面创建新的目录 pip 文件夹 (2)在 pip目录下创建后缀为ini,名为pip的文件,另存为 (pip.ini) 文件内容设置为:(清华源) [glob ...
- python中pip添加国内镜像源后显著加速下载
python中pip添加国内镜像源后显著加速下载 更换pip源到国内镜像,很多国外的库下载非常慢,添加国内镜像后安装下载速度提升非常明显(亲测有些可以由几十kb加速到几MB) pip国内的一些镜像阿里 ...
- python pip 安装常用库如何使用国内镜像源
最近通过python安装一些常用库发现下载速度特别慢,而且还会出现无法安装等错误,尝试找了一些国内的镜像源,发现阿里云的速度很快,这里做个记录,并分享给大家. 国内镜像源 阿里云:http://mir ...
- python pip 安装使用国内镜像源
国内镜像源 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 ...
- Ubuntu16.04下配置pip国内镜像源加速安装【转】
本文转载自:https://blog.csdn.net/yucicheung/article/details/79095742 问题描述 基于国内网速的问题,我们直接pip安装包通常速度非常慢,而且经 ...
随机推荐
- 阿里云-物联网IOT
https://iot.aliyun.com/?spm=5176.23056729.J_3207526240.265.3dcc3f06JR1HG2
- 如何快速的开发一个完整的iOS直播app(采集篇)
作者:袁峥链接:https://www.jianshu.com/p/c71bfda055fa来源:简书著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 开发一款直播app,首先需要 ...
- nginx详细参数配置(史上最全)
Nginx (engine x) 是一个轻量级高性能的HTTP和反向代理服务器,同时也是一个通用 代理服务器 (TCP/UDP/IMAP/POP3/SMTP),最初由俄罗斯人Igor Sysoev编写 ...
- 【python】如何优雅的终止while循环
1. 背景需求 python需要与外界或终端交互时,常常需要使用while循环一直跑. 如果需要终止程序,一般使用Ctrl+c,此时终端会打印一大堆backtrace,并且无法保留当前运行的状态,非常 ...
- 【推荐】一款开源且成熟的OA协同办公系统,自带低代码开发功能!
项目介绍 今天给大家推荐一款开源且拥有成熟的OA办公系统功能,自带低代码开发平台,可以快速搭建OA系统.人事系统.CRM系统.办公用品系统.项目管理系统.合同管理系统等,让你可以快速上手.快速实施.快 ...
- RocketMQ实战—2.RocketMQ集群生产部署
大纲 1.什么是消息中间件 2.消息中间件的技术选型 3.RocketMQ的架构原理和使用方式 4.消息中间件路由中心的架构原理 5.Broker的主从架构原理 6.高可用的消息中间件生产部署架构 7 ...
- 火了整个春节的DeepSeek,他对AI产品的意义到底是什么?
相信春节期间各位的朋友圈一定被DeepSeek"轰炸"了,就算是普通人也获得了一些信息:国内AI取得了巨大突破. 但DeepSeek这次突破到底对一般的互联网从业者有什么帮助,绝大 ...
- P10353 [PA2024] Grupa permutacji 题解
神秘!在这些排列生成的置换群 \(G\) 里,若 \(\exists \pi \in G\) 使得 \(\pi_i=k,\pi_j=l\),则所有这些 \((k,l)\) 被同样数量的 \(\pi\i ...
- 镇海-APIO联合总结
镇海考试见此处:https://www.cnblogs.com/british-union/p/liankao.html 考的是湖南省队集训,除了第一天有点头昏导致体验很差之外体验非常好,剩下两次考试 ...
- AI之Ollama
介绍 什么是llama LLaMA(Large Language Model Meta AI)是Meta开发的大规模预训练语言模型,基于Transformer架构,具有强大的自然语言处理能力.它在文本 ...