Anaconda3 pypi 清华大学TUNA镜像源使用帮助

参考来源:

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

Anaconda 是一个用于科学计算的 Python 发行版,支持 Linux, Mac, Windows, 包含了众多流行的科学计算、数据分析的 Python 包。

Anaconda 安装包可以到以下链接下载。

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
使用方法

镜像站提供了 Anaconda 仓库与第三方源(conda-forge、msys2、pytorch 等,各镜像站镜像的第三方源并不相同,可以参考下方「第三方镜像源」一节)的镜像,各系统都可以通过修改用户目录下的 .condarc 文件来使用镜像站。

不同系统下的 .condarc 目录如下:

Linux: ${HOME}/.condarcmacOS: ${HOME}/.condarcWindows: C:\Users\<YourUserName>\.condarc

注:
* Windows 用户无法直接创建名为 .condarc 的文件,可先执行 

conda config --set show_channel_urls yes 

生成该文件之后再修改。
* 由于更新过快难以同步,TUNA 等镜像站不同步 pytorch-nightly , pytorch-nightly-cpu , ignite-nightly 这三个包。
* 如果正在从某一镜像源切换到另一镜像源,请检查镜像源是否同步了所需要的 repo,以及该 repo 是否支持使用的平台 (e.g. linux-64)。
* 为了保证以下配置在所有镜像站可用,配置中只加入了少量必须的第三方源,可以在下方的列表中自行寻找并添加其他第三方源。

channels:  - defaultsshow_channel_urls: truedefault_channels:  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2custom_channels:  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

即可添加 Anaconda Python 免费仓库。

使用下列命令清除索引缓存,并安装常用包测试一下。

conda clean -i conda create -n myenv numpy


第三方源列表

可以遵循上述配置文件中的格式添加第三方源(推荐),或者通过以下命令添加第三方源:

第三方源 (参考原文)

conda config --set custom_channels.auto https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/

  


Miniconda

Miniconda 是一个 Anaconda 的轻量级替代,默认只包含了 python 和 conda,但是可以通过 pip 和 conda 来安装所需要的包。

Miniconda 安装包可以到以下链接下载。

https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/



PyPI 软件仓库

服务域名

如果您正在使用 TUNA 镜像站,可以使用 pypi.tuna.tsinghua.edu.cn 替换下面所有的 mirrors.tuna.tsinghua.edu.cn/pypi/web

BFSU 镜像站没有为 PyPI 提供独立服务域名。

PyPI 镜像在每次同步成功后间隔 5 分钟同步一次。

pip

临时使用
pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package
注意,simple 不能少。pip 要求使用 https ,因此需要 https 而不是 http
设为默认

升级 pip 到最新的版本后进行配置:

python -m pip install --upgrade pippip configset global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

python -m pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple --upgrade pip

配置多个镜像源

如果您想配置多个镜像源平衡负载,可在已经替换 index-url 的情况下通过以下方式继续增加源站:

pip configset global.extra-index-url"<url1> <url2>..."

请自行替换引号内的内容,源地址之间需要有空格。例如

pip configset global.extra-index-url"https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"

PDM

通过如下命令设置默认镜像:

pdm config pypi.url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

Poetry

通过以下命令为单个项目设置首选镜像:

poetrysource add --priority=primary mirrors https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

通过以下命令为单个项目设置补充镜像:
poetrysource add --priority=supplemental mirrors https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

Poetry 尚未支持全局设置镜像。

使用全局镜像的临时方案是将 Poetry 的安装器切换回 pip,如下所示。但该方式会在将来的版本中停止支持。

poetry config experimental.new-installerfalse

Homebrew

本节主要供 Homebrew 帮助(https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/)使用。

export HOMEBREW_PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值