博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
anaconda python更换清华源
阅读量:6476 次
发布时间:2019-06-23

本文共 6321 字,大约阅读时间需要 21 分钟。

前言

在使用anaconda python环境过程中你会发现使用conda下载包的速度非常的慢,因为使用的是国外的服务器,所以这里要设置为国内的镜像。使用下面的配置命令即可:

添加Anaconda的TUNA镜像

conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'      //TUNA的help中镜像地址加有引号,需要去掉# conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'conda config --setshow_channel_urls yes      //设置搜索时显示通道地址

添加后

(base) C:\Users\aikera>conda config --show channelschannels:  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'  - defaults  - conda-forge

还有简单粗暴地方法:直接修改conda的配置,一般在当前用户路径下,比如C:\Users\Administrator.condarc

.condarc具体内容如下:

channels:  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'  - defaults  - conda-forge

验证

conda config --show
(base) C:\Users\aikera>conda config --showadd_anaconda_token: Trueadd_pip_as_python_dependency: Trueaggressive_update_packages:  - ca-certificates  - certifi  - opensslallow_non_channel_urls: Falseallow_softlinks: Falsealways_copy: Falsealways_softlink: Falsealways_yes: Noneanaconda_upload: Noneauto_update_conda: Truechangeps1: Truechannel_alias: https://conda.anaconda.orgchannel_priority: Truechannels:  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'  - 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'  - defaults  - conda-forgeclient_ssl_cert: Noneclient_ssl_cert_key: Noneclobber: Falsecreate_default_packages: []custom_channels:  pkgs/r: https://repo.anaconda.com  pkgs/msys2: https://repo.anaconda.com  pkgs/main: https://repo.anaconda.com  pkgs/pro: https://repo.anaconda.com  pkgs/free: https://repo.anaconda.comcustom_multichannels:  local: []  defaults: ["https://repo.anaconda.com/pkgs/main", "https://repo.anaconda.com/pkgs/free", "https://repo.anaconda.com/pkgs/r", "https://repo.anaconda.com/pkgs/pro", "https://repo.anaconda.com/pkgs/msys2"]default_channels:  - https://repo.anaconda.com/pkgs/main  - https://repo.anaconda.com/pkgs/free  - https://repo.anaconda.com/pkgs/r  - https://repo.anaconda.com/pkgs/pro  - https://repo.anaconda.com/pkgs/msys2disallowed_packages: []download_only: Falseenvs_dirs:  - D:\ProgramData\Anaconda2\envs  - C:\Users\aikera\AppData\Local\conda\conda\envs  - C:\Users\aikera\.conda\envs

测试:

安装numpy试试:

(base) C:\Users\aikera>conda install numpySolving environment: /WARNING: The remote server could not find the noarch directory for therequested channel with url: https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'It is possible you have given conda an invalid channel. Please double-checkyour conda configuration using `conda config --show`.If the requested url is in fact a valid conda channel, please request that thechannel administrator create `noarch/repodata.json` and associated`noarch/repodata.json.bz2` files, even if `noarch/repodata.json` is empty.$ mkdir noarch$ echo '{}' > noarch/repodata.json$ bzip2 -k noarch/repodata.json/WARNING: The remote server could not find the noarch directory for therequested channel with url: https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'It is possible you have given conda an invalid channel. Please double-checkyour conda configuration using `conda config --show`.If the requested url is in fact a valid conda channel, please request that thechannel administrator create `noarch/repodata.json` and associated`noarch/repodata.json.bz2` files, even if `noarch/repodata.json` is empty.$ mkdir noarch$ echo '{}' > noarch/repodata.json$ bzip2 -k noarch/repodata.jsondone## Package Plan ##  environment location: D:\ProgramData\Anaconda2  added / updated specs:    - numpyThe following packages will be downloaded:    package                    |            build    ---------------------------|-----------------    numpy-1.15.0               |   py27h911edcf_0          36 KB  defaults    numpy-base-1.15.0          |   py27hfef472a_0         3.8 MB  defaults    llvmlite-0.24.0            |   py27hc56fc5f_0         9.2 MB  defaults    numba-0.39.0               |   py27h39f3610_0         2.4 MB  defaults    mkl_fft-1.0.4              |   py27h31cbb53_1         121 KB  defaults    mkl-2018.0.3               |                1       178.1 MB  defaults    conda-4.5.10               |           py27_0         1.0 MB  defaults    blas-1.0                   |              mkl           6 KB  defaults    ------------------------------------------------------------                                           Total:       194.7 MBThe following NEW packages will be INSTALLED:    blas:       1.0-mkl               defaults    mkl_fft:    1.0.4-py27h31cbb53_1  defaults    numpy-base: 1.15.0-py27hfef472a_0 defaultsThe following packages will be UPDATED:    conda:      4.4.11-py27_0         defaults --> 4.5.10-py27_0         defaults    llvmlite:   0.20.0-py27_0         defaults --> 0.24.0-py27hc56fc5f_0 defaults    mkl:        2018.0.0-h36b65af_4   defaults --> 2018.0.3-1            defaults    numba:      0.35.0-np113py27_10   defaults --> 0.39.0-py27h39f3610_0 defaults    numpy:      1.13.3-py27h9ac254c_0 defaults --> 1.15.0-py27h911edcf_0 defaultsProceed ([y]/n)? yDownloading and Extracting Packagesnumpy 1.15.0: ################################################################################################# | 100%numpy-base 1.15.0: ############################################################################################ | 100%llvmlite 0.24.0: ############################################################################################## | 100%numba 0.39.0: ################################################################################################# | 100%mkl_fft 1.0.4: ################################################################################################ | 100%mkl 2018.0.3: ################################################################################################# | 100%conda 4.5.10: ################################################################################################# | 100%blas 1.0: ##################################################################################################### | 100%Preparing transaction: doneVerifying transaction: doneExecuting transaction: done

转载于:https://blog.51cto.com/m51cto/2161697

你可能感兴趣的文章
Puppet module命令参数介绍(六)
查看>>
《UNIX网络编程》中第一个timer_server的例子
查看>>
CISCO 路由器(4)
查看>>
网络服务搭建、配置与管理大全(Linux版)
查看>>
Silverlight 5 Beta新特性[4]文本缩进控制
查看>>
springMVC多数据源使用 跨库跨连接
查看>>
Git服务端和客户端安装笔记
查看>>
Spring Security(14)——权限鉴定基础
查看>>
IntelliJ IDEA快捷键
查看>>
【iOS-cocos2d-X 游戏开发之十三】cocos2dx通过Jni调用Android的Java层代码(下)
查看>>
MongoDB的基础使用
查看>>
进程间通信——命名管道
查看>>
ssh登陆不需要密码
查看>>
ARP
查看>>
java mkdir()和mkdirs()区别
查看>>
桌面支持--excel自动换行
查看>>
虚拟化--003 vcac licence -成功案例
查看>>
windows server 2003各版本及2008各版本的最大识别内存大小
查看>>
OSChina 周六乱弹 ——揭秘后羿怎么死的
查看>>
IT人员的职业生涯规划
查看>>