Anaconda安装-在线和离线

离线安装Tensorflow
https://www.anaconda.com/download/
echo "hadoop ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

一 conda添加国内源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes
conda换回默认源
conda config --remove-key channels


二 conda当前的源设置在$HOME/.condarc中

可以通过文本查看器查看或着使用命令

[hadoop@localhost ~]$ conda config --show-sources
==> /home/hadoop/.condarc <==
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - defaults
show_channel_urls: True

三修改配置文件

~/.condarc
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - defaults
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
  - https://repo.continuum.io/pkgs/free
  - https://repo.continuum.io/pkgs/r
  - https://repo.continuum.io/pkgs/pro

四查看conda 源

[hadoop@localhost ~]$ conda config --show

五使用conda安装package时指定安装路径和channel
conda install --prefix=~/pyenv/py36 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ pytorch torchvision cuda91 -c pytorch

六 conda install
   -c CHANNEL, --channel CHANNEL
              Additional channel  to  search  for  packages.  These  are  URLs
              searched  in  the  order  they  are given (including file:// for
              local directories). Then, the defaults or channels from .condarc
              are  searched (unless --override-channels is given). You can use
              'defaults' to get the default packages for conda,  and  'system'
              to  get  the  system  packages,  which  also takes .condarc into
              account. You can also  use  any  name  and  the  .condarc  chan‐
              nel_alias  value will be prepended. The default channel_alias is
              http://conda.anaconda.org/.
conda删除channel
conda config –remove channels ‘https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/’ 
.condar文件内容
show_channel_urls: true
channels:
  - http://kolla.chenshake.com/pkgs/r/
  - http://kolla.chenshake.com/pkgs/pro/
  - http://kolla.chenshake.com/pkgs/main/
  - http://kolla.chenshake.com/pkgs/free/
  - defaults
report_errors: false
配置本地源

conda config --add channels http://kolla.chenshake.com/pkgs/free/
conda config --add channels http://kolla.chenshake.com/pkgs/main/
conda config --add channels http://kolla.chenshake.com/pkgs/pro/
conda config --add channels http://kolla.chenshake.com/pkgs/r/
conda config --remove channels http://kolla.chenshake.com/pkgs/free/
conda config --remove channels http://kolla.chenshake.com/pkgs/main/
conda config --remove channels http://kolla.chenshake.com/pkgs/pro/
conda config --remove channels http://kolla.chenshake.com/pkgs/r/
conda config --set show_channel_urls yes
conda config --add channels http://192.168.229.132/pkgs/free/
conda config --add channels http://192.168.229.132/pkgs/main/
conda config --add channels http://192.168.229.132/pkgs/pro/
conda config --add channels http://192.168.229.132/pkgs/r/
conda info
conda config --remove channels defaults
conda config --set show_channel_urls yes


移除默认channels_defaults
conda config --remove channels defaults
conda config --set show_channel_urls yes

安装软件包

conda install tensorflow
conda remove tensorflow
conda config --add channels http://192.168.229.132/pkgs/free/
conda config --add channels http://192.168.229.132/pkgs/main/
conda config --add channels http://192.168.229.132/pkgs/pro/
conda config --add channels http://192.168.229.132/pkgs/r/
conda config --set show_channel_urls yes
conda config --remove channels defaults
conda config --set show_channel_urls yes
conda config --set report_errors false

conda info
 active environment : None
       user config file : /home/hadoop/.condarc
 populated config files : /home/hadoop/.condarc
          conda version : 4.5.11
    conda-build version : 3.10.5
         python version : 3.6.5.final.0
       base environment : /home/hadoop/anaconda3  (writable)
           channel URLs : http://192.168.229.132/pkgs/r/linux-64
                          http://192.168.229.132/pkgs/r/noarch
                          http://192.168.229.132/pkgs/pro/linux-64
                          http://192.168.229.132/pkgs/pro/noarch
                          http://192.168.229.132/pkgs/main/linux-64
                          http://192.168.229.132/pkgs/main/noarch
                          http://192.168.229.132/pkgs/free/linux-64
                          http://192.168.229.132/pkgs/free/noarch
          package cache : /home/hadoop/anaconda3/pkgs
                          /home/hadoop/.conda/pkgs
       envs directories : /home/hadoop/anaconda3/envs
                          /home/hadoop/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.11 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-862.el7.x86_64 centos/7 glibc/2.17
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
[hadoop@localhost ~]$
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值