2022-02-25 23:46:47

解决pip安装慢

[TOC]

解决pip安装慢

解决pip安装慢
在学习Python的过程中,发现pip安装慢,经常timeout,因为国外镜像太慢了。

网上找了下解决方案。有两个。都是使用国内镜像。

临时解决

加-i参数。pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 软件包

永久解决。配置环境。

编辑 ~/.pip/pip.conf文件(如没有,请创建)

[global]
timeout = 60
https://pypi.tuna.tsinghua.edu.cn/simple
download-cache = /Users/maynard/software/pip_cache

download-cache是用来缓存下载的软件包的。这样就可以在多个虚拟环境里复用。
请把路径改成自己的。。

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

豆瓣镜像:http://pypi.douban.com/simple

阿里镜像: https://developer.aliyun.com/mirror/

本文链接:http://blog.go2live.cn/post/pip-slow.html

-- EOF --