网络编程
位置:首页>> 网络编程>> Python编程>> 一劳永逸彻底解决pip install慢的办法

一劳永逸彻底解决pip install慢的办法

作者:autofelix  发布时间:2023-08-10 20:30:52 

标签:pip,install,慢

前言

Python 的一大优点就是丰富的类库,所以我们经常会用 pip 来安装各种库,所以对于Python开发用户来讲,PIP安装软件包是家常便饭。但国外的源下载速度实在太慢,浪费时间。而且经常出现下载后安装出错问题。所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率。

一、将pip修改为pip国内源即可 

pip和很多的包管理工具一样,是从国外源下载的。因此速度会比较慢,甚至会安装不了

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:https://mirrors.aliyun.com/pypi/simple/

中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/

二、临时修改

可以在使用pip的时候加参数 -i https://pypi.tuna.tsinghua.edu.cn/simple


pip install pycrytodome -i https://pypi.tuna.tsinghua.edu.cn/simple

这样就会从清华镜像库去安装pycrytodome库 

三、永久修改

liunx系统


vim ~/.pip/pip.conf

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

window系统

在user目录中创建一个pip目录,如:C:\Users\pip,新建文件pip.ini,添加一下内容


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

总结

来源:https://blog.csdn.net/weixin_41635750/article/details/117197135

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com