python中怎么提高pipinstall速度

介绍

本篇内容主要讲解“python中怎么提高pipinstall速度”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“python中怎么提高pipinstall速度”吧!

pip安装命令默认是用的是python官方源,由于一些客观原因,连接速度很慢,甚至超时中断,到时很多模块安装不上,甚是苦恼!

怎么办?

使用国内镜像源,将以下命令完成拷贝出来,粘贴至记事本中,保存为蝙蝠文件,双击执行该批处理文件。

@echo offrem声明采用utf - 8编码chcp 65001回声\ * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ *回波自动设置pip安装配置文件回声\ * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * * * * \ \ * \ \ * \ \ * * * * \ \ * \ \ * \ \ * \ * * * * \ \ * \ \ * \ \ * *设置pipFolder=\ \ pip \ \如果存在% userprofile % % pipFolder % (echo目录% userprofile % % pipFolder %已存在无需创建)其他(echo创建% userprofile % % pipFolder % md % userprofile % % pipFolder %) cd % userprofile % % pipFolder %回声\[全球\]在皮普。ini (echo超时=60回声index-url=http://pypi.douban.com/simpleecho extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple/echo \[安装\]回声可信主机=pypi.douban.comecho pypi.tuna.tsinghua.edu.cnecho超时=10)在祝辞皮普。iniwmic环境中“name=& # 39; path & # 39;和用户名=& # 39;& lt; system> & # 39;“设置VariableValue=https://www.yisu.com/zixun/" % %路径;% userprofile % % pipFolder % pip.ini”

然后再试试pip安装命令,绝对飞一般的感觉。

另外给大家一些常用的pip国内源:

阿里云https://mirrors.aliyun.com/pypi/simple/中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/豆瓣(豆瓣)https://pypi.douban.com/simple/清华大学https://pypi.tuna.tsinghua.edu.cn/simple/中国科学技术大学https://pypi.mirrors.ustc.edu.cn/simple/

<强>使用方法

临时生效使用时加上参数我

如:

pip安装matplotlib - https://mirrors.aliyun.com/pypi/simple/

<强>永久生效

1. linux下,修改~/.pip/皮普。配置(没有就创建一个文件夹及文件。文件夹要加“。”,表示是隐藏文件夹)

内容如下:

(全球)index-url=https://mirrors.aliyun.com/pypi/simple/(安装)可信主机=mirrors.aliyun.com

2. windows下,直接在用户目录中创建一个pip目录,如:C: \ xx \ \用户皮普,新建文件pip.ini。内容同上。

python中怎么提高pipinstall速度