今天在使用conda安装包时,发现老是下载到一半报HTTP错误,中断了下载。且下载速度非常的慢:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
PS C:\Windows\system32> conda install libpython m2w64-toolchain -c msys2 Collecting package metadata (current_repodata.json): done Solving environment: done ## Package Plan ## environment location: D:\ProgramData\Anaconda3 added / updated specs: - libpython - m2w64-toolchain The following packages will be downloaded: package | build ---------------------------|----------------- m2w64-gcc-ada-5.3.0 | 6 33.5 MB msys2 ------------------------------------------------------------ Total: 33.5 MB The following NEW packages will be INSTALLED: libpython pkgs/main/win-64::libpython-2.1-py37_0 m2w64-binutils msys2/win-64::m2w64-binutils-2.25.1-5 m2w64-bzip2 msys2/win-64::m2w64-bzip2-1.0.6-6 m2w64-crt-git msys2/win-64::m2w64-crt-git-5.0.0.4636.2595836-2 m2w64-gcc msys2/win-64::m2w64-gcc-5.3.0-6 m2w64-gcc-ada msys2/win-64::m2w64-gcc-ada-5.3.0-6 m2w64-gcc-fortran msys2/win-64::m2w64-gcc-fortran-5.3.0-6 m2w64-gcc-objc msys2/win-64::m2w64-gcc-objc-5.3.0-6 m2w64-headers-git msys2/win-64::m2w64-headers-git-5.0.0.4636.c0ad18a-2 m2w64-isl msys2/win-64::m2w64-isl-0.16.1-2 m2w64-libiconv msys2/win-64::m2w64-libiconv-1.14-6 m2w64-libmangle-g~ msys2/win-64::m2w64-libmangle-git-5.0.0.4509.2e5a9a2-2 m2w64-make msys2/win-64::m2w64-make-4.1.2351.a80a8b8-2 m2w64-mpc msys2/win-64::m2w64-mpc-1.0.3-3 m2w64-mpfr msys2/win-64::m2w64-mpfr-3.1.4-4 m2w64-pkg-config msys2/win-64::m2w64-pkg-config-0.29.1-2 m2w64-toolchain msys2/win-64::m2w64-toolchain-5.3.0-7 m2w64-tools-git msys2/win-64::m2w64-tools-git-5.0.0.4592.90b8472-2 m2w64-windows-def~ msys2/win-64::m2w64-windows-default-manifest-6.4-3 m2w64-winpthreads~ msys2/win-64::m2w64-winpthreads-git-5.0.0.4634.697f757-2 m2w64-zlib msys2/win-64::m2w64-zlib-1.2.8-10 Proceed ([y]/n)? y Downloading and Extracting Packages m2w64-gcc-ada-5.3.0 | 33.5 MB | ######## | 11% CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/msys2/win-64/m2w64-gcc-ada-5.3.0-6.tar.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. |
于是就想着conda是否有像pip一样存在镜像源。上网查找果然有。具体配置流程为:
1、在命名行执行 conda config --set show_channel_urls yes
2、执行完成后会在你的用户目录下生成一个.condarc 的文件,编辑修改文件内容为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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/free - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r 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 |
大功告成,Happy Hacking~
参考链接:https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
打赏作者微信支付

支付宝
