CentOS 7 安装Anaconda及简单配置

一·Anaconda下载

进入anaconda官方网站下载个人免费版本,网站链接,点击download,选择Linux平台的安装包

二·Anaconda安装

1.执行如下指令,安装anaconda

# 进入当保存文件的目录,执行此指令, 后期由于版本更新,可能会与此文件命名有所不同
bash Anaconda3-2020.11-Linux-x86_64.sh

2.按照安装提示,键入回车,

Please, press ENTER  to continue
>>> ENTER

3.安装此版本时,会强制用户看完整个协议,直接一路回车就行,直到看到确认信息

# 输入yes,表示同意安装协议
Do you accept the license terms? [yes|no][no] 
>>> yes

4.确认安装路径(可修改,也可以使用自定义)

# 使用默认路径,直接键入回车,使用自定义路径,直接输入安装路径
# 此处使用 /opt/anaconda3作为安装路径
Anaconda3 will now be installed into this location:
/root/anaconda3  
- Press ENTER to confirm the location  
- Press CTRL-C to abort the installation  
- Or specify a different location below


[/root/anaconda3] >>> /opt/anaconda3

注:安装位置可以在执行安装脚本的时候直接指定,可以这样修改执行内容:

bash Anaconda3-2020.11-Linux-x86_64.sh -p /opt/anaconda3

这样可跳过软件安装路径确认阶段,直接安装到指定目录下。

5.环境变量初始化

# 此处询问是否初始化conda的环境,直接输入yes

Do you wish the installer to initialize Anaconda3
by running conda init? 

[yes|no][no] >>> yes

6.初始化时,anaconda将配置写入了~/.bashrc 文件,直接执行

source ~/.bashrc

后即可正常使用了。

7.配置多用户使用

将anaconda初始化时,写入到 ~/.bashrc 文件中的内容复制到 /etc/bashrc 文件中,内容如下(此处仅为示例,请复制本机对应文件中的相应内容)

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

再执行 source /etc/bashrc 指令即可。

三·配置镜像源

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
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/
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

  • 8
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值