Python 安装某个库,出现 Read_Time_out 错误,那么如何配置 “国内镜像源”呢?
阅读本文大概需要 4 分钟。
问题来源
ReadTimeoutError: HTTPSConnectionPool(host=
‘files.pythonhosted.org’, port=443): Read timed out.
配置国内镜像源
-
清华源:https://pypi.tuna.tsinghua.edu.cn/simple/ -
阿里云:http://mirrors.aliyun.com/pypi/simple/ -
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
① 临时使用“国内镜像源”
# 直接下载,速度慢
pip install pandas
# 使用国内镜像源下载,速度快
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple/
② 永久使用“国内镜像源”
# 创建目录
mkdir ~/.pip
# 切换到该目录下
cd ~/.pip
# 在该目录下,创建一个文件
touch pip.conf
sudo vi ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn # trusted-host 此参数是为了避免麻烦,否则使用的时候可能会提示不受信任
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn
End
「进击的Coder」专属学习群已正式成立,搜索「CQCcqc4」添加崔庆才的个人微信或者扫描下方二维码拉您入群交流学习。
原文始发于微信公众号(进击的Coder):Python 安装某个库,出现 Read_Time_out 错误,那么如何配置 “国内镜像源”呢?
THE END
0
二维码
海报
Python 安装某个库,出现 Read_Time_out 错误,那么如何配置 “国内镜像源”呢?
这是「进击的Coder」的第 418 篇技术分享
作者:黄伟呢
来源:快学Python
“
阅读本文大概需要 4 分钟。
”
问题来源
今天在使用 pip install x……