【Conda】【Anaconda】Linux下安装Anaconda

本文记录Linux安装Anaconda的过程.

1. 简介

https://www.anaconda.com/
https://docs.anaconda.com/
https://docs.conda.io/en/latest/
https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html

2. 安装 Anconda

2.1 下载安装脚本

https://www.anaconda.com/products/individual下载Anaconda3-2020.11-Linux-x86_64.sh 脚本文件,大约500M左右.

2.2 执行安装脚本

启动安装脚本.

$ bash Anaconda3-2020.11-Linux-x86_64.sh

Welcome to Anaconda3 2020.11

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

回车继续.

===================================
End User License Agreement - Anaconda Individual Edition
===================================

Copyright 2015-2020, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

This End User License Agreement (the "Agreement") is a legal agreement between y
ou and Anaconda, Inc. ("Anaconda") and governs your use of Anaconda Individual E
dition (which was formerly known as Anaconda Distribution).

Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusi
ve, non-transferable license to:

  * Install and use the Anaconda Individual Edition (which was formerly known as
 Anaconda Distribution),
  * Modify and create derivative works of sample source code delivered in Anacon
da Individual Edition from Anaconda's repository; and
  * Redistribute code files in source (if provided to you by Anaconda as source)
 and binary forms, with or without modification subject to the requirements set 
forth below.

--More--

回车空格翻页.


Do you accept the license terms? [yes|no]
[no] >>> 

输入yes回车.


Anaconda3 will now be installed into this location:
/home/clyde/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/clyde/anaconda3] >>>

直接回车.

稍等一会.

Preparing transaction: done
Executing transaction: done
installation finished.

文件安装完毕.

Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>>

默认为no,直接回车.


You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:

eval "$(/home/clyde/anaconda3/bin/conda shell.YOUR_SHELL_NAME hook)" 

To install conda's shell functions for easier access, first activate, then:

conda init

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false
Thank you for installing Anaconda3!

===========================================================================

安装脚本执行结束.

2.3 设置环境变量

激活base虚拟环境.

$ source ~/anaconda3/bin/activate
(base) $

初始化shell设置.

(base) $ conda init

conda init 命令实质是在~/.bashrc末尾添加以下内容:

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

设置启动shell时不自动激活base环境.

(base) $ conda config --set auto_activate_base false

2.4 测试

重新启动或打开新的终端.

$ conda --version
conda 4.9.2

安装成功.

猜你喜欢

转载自blog.csdn.net/RadiantJeral/article/details/110288050
今日推荐