彻底解决Python包下载慢问题

python默认使用的是国外镜像,有时候下载非常慢,最快的办法就是在下载命令中增加国内源:

常用的国内源如下:

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

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

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

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

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

临时使用pip+国内源

示例:

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

永久使用pip+国内源

示例:

# 永久设置阿里云的国内源
pip config set global.trusted-host mirrors.aliyun.com
pip config set global.index-url https://mirrors.aliyun.com/simple

# 永久设置清华大学的国内源
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/

其他常用的pip命令

pip list                                           查看已安装包列表
pip install numpy                          直接安装包
pip install numpy==1.11.0            安装指定版本为1.11.0的numpy包
pip install –upgrade numpy         升级包
pip uninstall numpy                      卸载包

Pycharm中修改库下载源

在setting中按如下路径打开包下载

彻底解决Python包下载慢问题

 点击“+”

彻底解决Python包下载慢问题

 在Available Packages 对话框中,点击Manage Respositories彻底解决Python包下载慢问题

 点击"+" 添加国内源路径即可

彻底解决Python包下载慢问题

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

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

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年3月5日 下午5:11
下一篇 2023年3月5日

相关推荐