如何在Ubuntu 20.04上安装Anaconda Python发行版[快速入门]

介绍 (Introduction)

Anaconda is an open-source package manager, environment manager, and distribution of the Python and R programming languages.

Anaconda是一个开源软件包管理器,环境管理器,以及Python和R编程语言的发行版。

This tutorial will guide you through installing the Python 3 version of Anaconda on an Ubuntu 20.04 server. For a more detailed version of this tutorial, with more thorough explanations of each step, please refer to How To Install the Anaconda Python Distribution on Ubuntu 20.04.

本教程将指导您在Ubuntu 20.04服务器上安装Python 3版本的Anaconda。 有关本教程的更详细版本,以及每个步骤的更详尽说明,请参阅如何在Ubuntu 20.04上安装Anaconda Python发行版 。

步骤1 —检索最新版本的Anaconda (Step 1 — Retrieving the Latest Version of Anaconda)

From a web browser, find the latest version of Anaconda for Python 3 at the Anaconda Downloads page:

通过网络浏览器,在Anaconda下载页面上找到适用于Python 3的最新版本的Anaconda:

https://www.anaconda.com/distribution/

At the time of writing, the latest version is 2020.02, but you should use a later stable version if it is available.

在撰写本文时,最新版本为2020.02,但如果可用,则应使用更高的稳定版本。

第2步-下载Anaconda Bash脚本 (Step 2 — Downloading the Anaconda Bash Script)

Change to the /tmp directory on your Ubuntu 20.04 server as a sudo non-root user.

以sudo非root用户身份更改到Ubuntu 20.04服务器上的/tmp目录。

  • cd /tmp

    cd / tmp

Use curl to download the link that you copied from the Anaconda website. We’ll output this to a file called anaconda.sh for quicker use.

使用curl下载您从Anaconda网站复制的链接。 我们将其输出到一个名为anaconda.sh的文件中,以加快使用速度。

  • curl https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh --output anaconda.sh

    卷曲https://repo.anaconda.com/archive/Anaconda3- 2020.02 -Linux-x86_64.sh --output anaconda.sh

步骤3 —验证安装程序的数据完整性 (Step 3 — Verifying the Data Integrity of the Installer)

We can now verify the data integrity of the installer with cryptographic hash verification through the SHA-256 checksum and the script we named anaconda.sh.

现在,我们可以通过SHA-256校验和和名为anaconda.sh的脚本,通过加密哈希验证来验证安装程序的数据完整性。

  • sha256sum anaconda.sh

    sha256sum anaconda.sh

   
   
     
     
     
     
Output
2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb anaconda.sh

You should check the output against the hashes available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version.

您应该对照64位Linux页面上带有Python 3的Anaconda上可用的哈希值检查输出,以找到合适的Anaconda版本。

第4步—运行Anaconda脚本 (Step 4 — Running the Anaconda Script)

  • bash anaconda.sh

    bash anaconda.sh

You’ll receive the following output to review the license agreement by pressing ENTER until you reach the end.

通过按ENTER直到结束,您将收到以下输出以查看许可协议。


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

When you get to the end of the license, type yes as long as you agree to the license to complete installation.

当您到达许可证末尾时,只要您同意许可证即可完成安装,请键入yes

第5步-完成安装过程 (Step 5 — Completing the Installation Process)

Choose the location of your installation or press ENTER to accept the default location.

选择安装位置或按ENTER接受默认位置。


   
   
     
     
     
     
Output
Anaconda3 will now be installed into this location: /home/sammy/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/sammy/anaconda3] >>>

At this point, the installation process will continue. Note that it may take some time.

此时,安装过程将继续。 请注意,这可能需要一些时间。

步骤6 —选择选项 (Step 6 — Selecting Options)

Once installation is complete, you’ll receive the following output:

安装完成后,您将收到以下输出:


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

Type yes so that you can initialize Anaconda3. You’ll receive some output that states changes made in various directories along with a thank you for installing Anaconda.

键入yes以便您可以初始化Anaconda3。 您将收到一些输出,其中指出在各个目录中所做的更改,并感谢您安装Anaconda。

步骤7 —激活安装 (Step 7 — Activating the Installation)

You can now activate the installation by sourcing the ~/.bashrc file:

现在,您可以通过采购~/.bashrc文件来激活安装:

  • source ~/.bashrc

    来源〜/ .bashrc

Once you have done that, you’ll be placed into the default base programming environment.

完成此操作后,您将进入默认的base编程环境。

第8步-测试安装 (Step 8 — Testing the Installation)

Use the conda command to test the installation and activation:

使用conda命令测试安装和激活:

  • conda list

    conda清单

You’ll receive output of all the packages you have available through the Anaconda installation:

您将收到通过Anaconda安装可获得的所有软件包的输出:

第9步-设置Anaconda环境 (Step 9 — Setting Up Anaconda Environments)

It’s best practice to create new environments for each of your projects. To create a Python 3 environment called my_env the syntax is as follows:

最好的做法是为每个项目创建新的环境。 要创建名为my_env的Python 3环境,语法如下:

  • conda create --name my_env python=3

    conda创建--name my_env python = 3

Press y to verify setup.

y确认设置。

You can activate your new environment by typing the following:

您可以通过键入以下内容来激活新环境:

  • conda activate my_env

    conda激活my_env

With your environment activated, your command prompt prefix will reflect that you are no longer in the base environment, but in the new one that you just created.

激活环境后,命令提示符前缀将反映您不再处于base环境中,而是处于刚创建的新环境中。

When you’re ready to deactivate your Anaconda environment, you can do so by typing:

当您准备停用Anaconda环境时,可以键入以下命令:

  • conda deactivate

    conda停用

翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-20-04-quickstart

你可能感兴趣的:(python,linux,ubuntu,java,深度学习)