昆明网站推广公司,整体vi设计公司,品牌建设英文,国家城乡和住房建设部网站首页换源对于我们在国内的python使用者来说是非常有必要的#xff0c;之前讲了pip如何换源。
pip更换为国内镜像源的步骤#xff0c;为什么要更换镜像源
那现在讲一下conda如何换源。
conda换源#xff08;清华源#xff09;
有时候#xff0c;conda虽然和pip共用一个本地…换源对于我们在国内的python使用者来说是非常有必要的之前讲了pip如何换源。
pip更换为国内镜像源的步骤为什么要更换镜像源
那现在讲一下conda如何换源。
conda换源清华源
有时候conda虽然和pip共用一个本地python第三方库包package文件夹但是这二者的下载第三方包的来源和方式都截然不同。所以导致了pip换源和conda换源也不同。
换源可以理解为把我们要下载第三方包的网络地址改为国内的地址。国内做的比较好的python源有清华源、华为源、阿里源等等。
今天我们以换清华源为例进行conda换源。以下换源方法分为两种win10和ubuntu22两个系统。
下面的方法经过了我的测试都可以成功换为清华源。如何你想换为其他 的国内python源把清华源的地址改为你想换的源的地址具体操作请百度一下。 1 Windows系统 TUNA 提供了 Anaconda 仓库与第三方源的镜像各系统都可以通过修改用户目录下的 .condarc 文件。Windows 用户无法直接创建名为 .condarc 的文件可先执行conda config --set show_channel_urls yes生成该文件之后再修改。 完成这一步后我们需要修改C:\Users\User_name\.condarc这个文件 打开后将文件里原始内容删除将下面的内容复制进去并保存。
channels:- defaults
show_channel_urls: true
default_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/msys2
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmsys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudbioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmenpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudsimpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud 这一步完成后我们需要打开Anaconda Prompt 运行 conda clean -i 清除索引缓存保证用的是镜像站提供的索引。 在win10下的conda换源大功告成。 2 Linux系统
在Linux系统下我们还是需要修改.condarc来进行换源
cd ~
vim .condarc
在vim下我们需要输入i进入编辑模式将下方内容粘贴进去
channels:
- defaults
show_channel_urls: true
default_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/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
按ESC退出编辑模式输入:wq保存并退出 我们可以通过conda config --show default_channels检查下是否换源成功如果出现下图内容即代表我们换源成功。