python更换国内源

曾经终败给现在 2023-05-29 05:06 77阅读 0赞

解决pip下载速度慢的问题

  • Linux及Mac环境
  • Windows环境

Linux及Mac环境

1.编辑pip.conf

  1. mkdir -p ~/.pip
  2. vim ~/.pip/pip.conf

2.更换国内源

  1. [global]
  2. index-url = https://pypi.tuna.tsinghua.edu.cn/simple
  3. [install]
  4. trusted-host = https://pypi.tuna.tsinghua.edu.cn

3.临时使用:

  1. 可以在使用pip的时候在后面加上-i参数,指定pip
  2. pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

4.pip国内的一些镜像

  1.   阿里云 http://mirrors.aliyun.com/pypi/simple/
  2.   中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  3.   豆瓣(douban) http://pypi.douban.com/simple/
  4.   清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  5.   中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

Windows环境

1.点击此电脑,在最上面的的文件夹窗口输入 : %APPDATA%
2.按回车跳转到以下目录,新建pip文件夹
3.创建pip.ini文件

  1. [global]
  2. timeout = 6000
  3. index-url = https://pypi.tuna.tsinghua.edu.cn/simple
  4. trusted-host = pypi.tuna.tsinghua.edu.cn

发表评论

表情:
评论列表 (有 0 条评论,77人围观)

还没有评论,来说两句吧...

相关阅读