修改python的pip源为国内源

1,在后边加个-i参数指定pip源,如下所示:

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


2,永久改变
  • Linux:
  1. cd ~                   # 进入家目录 
  2. mkdir .pip          # 新建.pip隐藏文件夹
  3. touch pip.conf   # 新建pip.conf文件
  4. vim pip.conf      # 用vim编辑pip.conf文件
    [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
  5. 保存退出

其他国内pip源:

  1. 豆瓣 ··············· http://pypi.douban.com/
     
    华中理工大学 ········ http://pypi.hustunique.com/ 
     
    山东理工大学 ········ http://pypi.sdutlinux.org/ 
     
    中国科学技术大学 ···· http://pypi.mirrors.ustc.edu.cn/ 
     
    阿里云 ············· http://mirrors.aliyun.com/pypi/simple/  
     
    清华大学 ··········· https://pypi.tuna.tsinghua.edu.cn/simple/ 
 
原文地址:https://www.cnblogs.com/mingyunrangwozoudaoxianzai/p/13495135.html