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发行版 。
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,但如果可用,则应使用更高的稳定版本。
Change to the /tmp
directory on your Ubuntu 20.04 server as a sudo non-root user.
以sudo非root用户身份更改到Ubuntu 20.04服务器上的/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
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
的脚本,通过加密哈希验证来验证安装程序的数据完整性。
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版本。
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
。
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.
此时,安装过程将继续。 请注意,这可能需要一些时间。
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。
You can now activate the installation by sourcing the ~/.bashrc
file:
现在,您可以通过采购~/.bashrc
文件来激活安装:
Once you have done that, you’ll be placed into the default base
programming environment.
完成此操作后,您将进入默认的base
编程环境。
Use the conda
command to test the installation and activation:
使用conda
命令测试安装和激活:
You’ll receive output of all the packages you have available through the Anaconda installation:
您将收到通过Anaconda安装可获得的所有软件包的输出:
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环境时,可以键入以下命令:
翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-the-anaconda-python-distribution-on-ubuntu-20-04-quickstart