Ubuntu/Windows给pip换源

Windows给pip换源

  • 打开appdata文件夹,在资源管理器的地址栏输入%appdata%后回车:

或者win+r打开命令运行,然后输入%appdata%也可以到该文件目录

在这里插入图片描述

  • 新建文件夹和文件
    • 新建一个名为pip的文件夹
    • 在pip文件夹里面新建名为pip.ini文件
    • 将下面信息添加在pip.ini文件内
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
  • 总结
    在这里插入图片描述
  • 测试一下

成功修改为清华源

在这里插入图片描述

Ubuntu给pip换源

  • 首先编辑
mkdir ~/.pip
vim ~/.pip/pip.conf
  • 加入源
[global]
index-url = https://mirrors.aliyun.com/pypi/simple

在这里插入图片描述

  • pip国内的一些镜像
  • 阿里云 http://mirrors.aliyun.com/pypi/simple/
  • 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  • 豆瓣(douban) http://pypi.douban.com/simple/
  • 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  • 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
原创文章 116 获赞 207 访问量 66万+

猜你喜欢

转载自blog.csdn.net/sexyluna/article/details/105741808