用清华源等国内镜像加速Python常用库的安装

在github上下载一些神经网络时,常看到requirement.txt文件,作者也提供了安装命令pip install -r requirements.txt,  然而这样直接安装速度较慢,因此通过添加国内的镜像源可以加快所需库的安装速度,命令如下:

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

当单独安装某个库的时候,比如numpy,可以使用如下命令:

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

有时通过清华镜像源安装会出现问题,可以尝试通过更改为其它国内的镜像源来解决,如下是国内的其它镜像源:

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

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

#豆瓣(douban)
http://pypi.douban.com/simple/

#中国科学技术大学
http://pypi.mirrors.ustc.edu.cn/simple/

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

更改示例:

#更改为阿里云镜像
pip install numpy -i http://mirrors.aliyun.com/pypi/simple/

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2023年9月8日
下一篇 2023年9月8日

相关推荐