Ubuntu 20.04 安装 Anaconda

概述

Anaconda 是一个开源的 Python 和 R 语言的发行版本,适用于数据分析、机器学习、大数据处理等数据科学领域,是目前最流行的数据分析平台。

Anaconda 可以简化软件包的管理和部署,它内部使用软件包管理系统 conda 来进行管理。

本文将介绍如何在 Ubuntu 20.04 系统上安装 Anaconda,软件下载源选择的是清华大学开源软件镜像站,下载的版本为 Anaconda3-5.3.1。

更新 apt

1sudo apt update
2sudo apt upgrade -y

下载安装脚本

如果没有安装 curl 工具,则需首先安装 curl

1sudo apt install -y curl

下载安装脚本并保存为 anaconda.sh

1curl https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh --output anaconda.sh

校验安装脚本

1sha256sum anaconda.sh

执行安装脚本

执行安装脚本:

 1$ bash anaconda.sh
 2
 3Welcome to Anaconda3 5.3.1
 4
 5In order to continue the installation process, please review the license
 6agreement.
 7Please, press ENTER to continue
 8>>> 
 9===================================
10Anaconda End User License Agreement
11===================================
12
13Copyright 2015, Anaconda, Inc.
14...
15Do you accept the license terms? [yes|no]
16>>> yes
17
18Anaconda3 will now be installed into this location:
19/home/chenyi/anaconda3
20
21  - Press ENTER to confirm the location
22  - Press CTRL-C to abort the installation
23  - Or specify a different location below
24
25[/home/chenyi/anaconda3] >>> 
26PREFIX=/home/chenyi/anaconda3
27
28installing: python-3.7.0-hc3d631a_0 ...
29Python 3.7.0
30installing: blas-1.0-mkl ...
31installing: ca-certificates-2018.03.07-0 ...
32installing: conda-env-2.6.0-1 ...
33installing: intel-openmp-2019.0-118 ...
34installing: libgcc-ng-8.2.0-hdf63
35...
36installing: anaconda-5.3.1-py37_0 ...
37installation finished.
38Do you wish the installer to initialize Anaconda3
39in your /home/chenyi/.bashrc ? [yes|no]
40>>> yes
41You may wish to edit your /home/chenyi/.bashrc to setup Anaconda3:
42
43source /home/chenyi/anaconda3/etc/profile.d/conda.sh
44
45Thank you for installing Anaconda3!

安装过程中需要确认同意协议、安装位置等。

验证安装

查看 Anaconda 信息:

 1$ conda info
 2
 3     active environment : None
 4            shell level : 0
 5       user config file : /home/chenyi/.condarc
 6 populated config files : 
 7          conda version : 4.5.11
 8    conda-build version : 3.15.1
 9         python version : 3.7.0.final.0
10       base environment : /home/chenyi/anaconda3  (writable)
11           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
12                          https://repo.anaconda.com/pkgs/main/noarch
13                          https://repo.anaconda.com/pkgs/free/linux-64
14                          https://repo.anaconda.com/pkgs/free/noarch
15                          https://repo.anaconda.com/pkgs/r/linux-64
16                          https://repo.anaconda.com/pkgs/r/noarch
17                          https://repo.anaconda.com/pkgs/pro/linux-64
18                          https://repo.anaconda.com/pkgs/pro/noarch
19          package cache : /home/chenyi/anaconda3/pkgs
20                          /home/chenyi/.conda/pkgs
21       envs directories : /home/chenyi/anaconda3/envs
22                          /home/chenyi/.conda/envs
23               platform : linux-64
24             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/5.15.0-48-generic ubuntu/20.04 glibc/2.31
25                UID:GID : 1000:1000
26             netrc file : None
27           offline mode : False

总结

Ubuntu 20.04 安装 Anaconda 的步骤如下:

  1. 更新 apt
  2. 下载安装脚本
  3. 校验安装脚本
  4. 执行安装脚本
  5. 验证安装

参考资料

  1. Anaconda | The World’s Most Popular Data Science Platform
  2. Anaconda (Python distribution) - Wikipedia
  3. Index of /anaconda/archive/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
下一页
上一页

相关