pip,anaconda 换国内源

  • 时间:2020-04-24 18:54 作者:大地之上 来源: 阅读:609
  • 扫一扫,手机访问
摘要:1. 为什么要换源假如你的网络足够好,那就不要换了,个人认为国外源还是最好的,可惜人生不如意事十之八九,时不时出现的timeout实在太让人揪心了。2. PIP 换源2.1 国内源阿里云 https://mirrors.aliyun.com/pypi/simple/中国科技大学 https://py

1. 为什么要换源

假如你的网络足够好,那就不要换了,个人认为国外源还是最好的,可惜人生不如意事十之八九,时不时出现的timeout实在太让人揪心了。

2. PIP 换源

2.1 国内源

  • 阿里云 https://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/
  • 中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/

2.2.1 临时使用

可以在pip后面加上-i 参数制定源, eg:

pip install scrapy -i http://mirrors.aliyun.com/pypi/simple/

2.2.2 永久修改

  • Windows
    在user目录中创立一个pip目录,例如: c:\users\xxx\pip,创立文件pip.ini, 内容如下
[global]index-url=http://mirrors.aliyun.com/pypi/simple/
  • Linux
    修改~/.pip/pip.conf
[global]index-url=http://mirrors.aliyun.com/pypi/simple/

3. Conda 换源

3.1 Windows

  • 清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  • 中科大源
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
  • 搜索时显示通道地址
conda config --set show_channel_urls yes

3.2 Linux

将以上配置~/.condarc 中

vim ~/.condarc
channels:  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/  - defaultsshow_channel_urls: true
  • 全部评论(0)
最新发布的资讯信息
【系统环境|】Fortigate飞塔防火墙如何开启DNS转发/DNS代理(2025-10-14 23:58)
【系统环境|】有了它,再也不用担心电脑弹窗广告和病毒啦!(2025-10-14 23:57)
【系统环境|】如何关闭恼人的电脑弹窗广告?2招搞定(2025-10-14 23:55)
【系统环境|】实用软件推荐:电脑广告弹窗多?用他,都给你屏蔽掉!(2025-10-14 23:55)
【系统环境|】Nginx篇01——基本安装配置和静态页面设置(2025-10-14 23:54)
【系统环境|】Linux端口开放,查看,删除,防火墙(2025-10-14 23:53)
【系统环境|】安全HTTP头部配置: 基于CSP与HSTS的Web安全策略(2025-10-14 23:52)
【系统环境|】老K:做私域过1000万的赛道全部都聚焦在女性身上!(2025-10-14 23:51)
【系统环境|】JavaScript跨域问题: 如何解决跨域访问和资源共享的安全策略(2025-10-14 23:51)
【系统环境|】家庭七级财务防火墙(2025-10-14 23:50)
手机二维码手机访问领取大礼包
返回顶部