当前位置:   article > 正文

Python:python镜像源管理_python查看镜像源

python查看镜像源


常用镜像源

清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

更新pip

python -m pip install --index-url https://pypi.douban.com/simple --upgrade pip
  • 1

配置镜像源

(1)pycharm内部配置

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
重启软件后,随便装一个模块,如下:(你可以看到下载模块速度很快!)
在这里插入图片描述

(2)手动添加镜像源,临时使用

使用方法:shell pip install 下载的模块名 -i https://pypi.tuna.tsinghua.edu.cn/simple
比如我要下载numpy这个模块,执行以下命令:

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

在这里插入图片描述

这个方法的好处就是,你不用像其它配置一样要去配置一遍,你只需要在后面加上:

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

(3) 永久配置镜像源,设置默认

方法1: 到cmd执行如下命令创建pip.ini: shell pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
在这里插入图片描述
然后我们把这个路径添加到系统环境变量就好了(怎么添加环境变量?跟前面给pip添加环境变量一样操作,只是路径不一样),貌似不添加到环境变量也可以使用

方法二:如果刚刚这个命令你执行失败,你可以自己在c盘创建一个文件名叫做pip,pip文件夹下创建一个文件名pip.ini,内容为:

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

还是一样添加到环境变量。

anaconda

添加镜像源

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
  • 1
  • 2
  • 3
  • 4

显示已有镜像源

conda config --show channels
  • 1

anaconda 删除已有镜像源

conda config --remove channels 源名称或链接 
conda config --remove-key channels  # 删除所有源
  • 1
  • 2

小结

https://blog.csdn.net/qq_42745706/article/details/123659643
https://blog.csdn.net/weixin_45779095/article/details/120143727
https://zhuanlan.zhihu.com/p/573955401

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/992308
推荐阅读
相关标签
  

闽ICP备14008679号