热搜词
发表于 前天 16:04 | 显示全部楼层 |阅读模式
方法1:(永久更改)
在python的命令提示符中运行以下语句,该条语句将pip的下载源永久更改为某个镜像站,这里以清华大学开源镜像站为例:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/


方法2:(永久更改)
windows环境下,在用户目录中创建一个文件夹,该文件夹的命名为pip;在该pip文件夹中新建一个文件pip.ini,pip.ini的内容如下:(完整路径:C:\Users\用户名\pip\pip.ini)

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

[install]

trusted-host=pypi.tuna.tsinghua.edu.cn

disable-pip-version-check = true

timeout = 6000


方法3:(临时性使用)
在安装库的时候,临时需要用到某个镜像,这里以清华大学镜像为例下载pandas库:

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


备注:pip下载源常用的国内镜像如下:

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

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

华为云:https://repo.huaweicloud.com/repository/pypi/simple

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

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

如果部分内容涉及侵权,请联系作者删除相关内容

全部评论0
回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|管理员之家 ( 苏ICP备2023053177号-2 )

GMT+8, 2025-4-13 02:39 , Processed in 0.162578 second(s), 23 queries .

Powered by Discuz! X3.5

Cpoyright © 2001-2025 Discuz! Team