[PY爬坑] 修改PIP源为国内源

在通过pip install 命令安装第三方包的时候 会直接访问国外服务器 连接速度很慢 修改源后 速度会快很多 

推荐的国内pip源:

中国科学技术大学      http://pypi.mirrors.ustc.edu.cn/ 
 
阿里云               http://mirrors.aliyun.com/pypi/simple/  
 
清华大学             https://pypi.tuna.tsinghua.edu.cn/simple/

临时修改:在后边加个-i参数指定pip源,如下所示:

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

永久修改:需要修改配置文件 

  • Windows:
  1. 进入%APPDATA%目录,例如C:\Users\gcstk\AppData\Roaming
  2. 新建pip文件夹,如果有则跳过
  3. 新建pip.ini文件,设置pip源,如下所示为清华大学的pip源
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
timeout = 6000
 
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
 
disable-pip-version-check = true

最后[PY爬坑] 修改PIP源为国内源_第1张图片

更改成功!

 

 

 

你可能感兴趣的:(PYthon,爬坑)