Ubuntu20.04 安装 Anaconda步骤

下载Anconda安装包

安装Anaconda之前需要先下载安装包,这里提供两种下载方式:网页手动下载、wget命令下载。两种方式均可,我自己使用的是wget命令行下载。因为wget命令非常稳定。

方法1:网页手动下载

在Ubuntu系统里面使用浏览器进入Anaconda官网:https://www.anaconda.com/ 直接选择Download,会自动识别系统下载最新的版本。
在这里插入图片描述
也可以点上图中红色方框位置跳转下载页面。
在这里插入图片描述

点击Download下载到本地(PS:Anaconda会根据访问网页所使用的系统,推荐对应的Anaconda版本,用户无需担心版本错误。如果有特定版本需要的朋友,则可以根据需要自行下载对应版本的Anaconda)。

方法2:wget命令下载

可以去清华大学开软软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/下载各种版本的Anaconda。
我使用的是Ubuntu,安装命令如下:wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
也可以到官方网站下载 wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
下面是官方路径下载结果:

root@interactive4805:/opt/data/private# wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
--2023-06-01 01:37:08--  https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8303, ...
Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.130.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 902411137 (861M) [application/x-sh]
Saving to: 'Anaconda3-2023.03-1-Linux-x86_64.sh'

Anaconda3-2023.03-1-Linux-x86_64.sh     100%[=====================================>] 860.61M  7.10MB/s    in 2m 10s  

2023-06-01 01:39:20 (6.60 MB/s) - 'Anaconda3-2023.03-1-Linux-x86_64.sh' saved [902411137/902411137]
  1. 安装Anaconda
    STEP1:使用bash命令安装Anaconda
root@interactive4805:/opt/data/private# bash Anaconda3-2023.03-1-Linux-x86_64.sh -p /usr/local/anaconda3

注意bash指令后面 -p 指定anaconda3安装路径。
指令执行结果:

root@interactive4805:/opt/data/private# bash Anaconda3-2023.03-1-Linux-x86_64.sh -p /usr/local/anaconda3

Welcome to Anaconda3 2023.03-1

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

安装过程中,看到提示“In order to continue the installation process, please review the license agreement.”(“请浏览许可证协议以便继续安装。”),点击“Enter”查看“许可证协议”。

STEP2:阅读并接受安装协议
在STEP1中已经执行了安装命令。指令执行结果首先让我们审阅安装协议,这里一直按Enter直到出现 Do you accept the license terms? [yes|no] ,表示协议阅读完毕输入yes即可继续安装,如下:

Export; Cryptography Notice
===========================

You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end users, and end use.  Anaconda Distribution includes cryptographic software. The 
country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations
 and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See the Wassenaar Arrangement http://www.wassenaar.org/ for more information.

Anaconda has self-classified this software as Export Commodity Control Number (ECCN) EAR99 which includes mass market information security software using or performing cryptographic functions with asymmetric algorithms. No license is re
quired for export of this software to non-embargoed countries.

The Intel Math Kernel Library contained in Anaconda Distribution is classified by Intel as ECCN 5D992.c with no license required for export to non-embargoed countries.

The following packages listed on https://www.anaconda.com/cryptography are included in the repository accessible through Anaconda Distribution that relate to cryptography.

Last updated February 25, 2022


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

STEP3:确认安装位置
在STEP2输入yes后会提示确认安装位置,这里点击Enter,默认即可,界面如下:

Anaconda3 will now be installed into this location:
/usr/local/anaconda3

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

[/usr/local/anaconda3] >>> 

接下来Anaconda就会开始安装。
STEP4:初始化Anaconda(包含环境变量的设置)
执行完STEP3Anaconda在Ubuntu系统里面的安装基本完毕了,但是还需要最后一步 初始化Anaconda,这一步只需要根据提示输入yes即可,如下:

Preparing transaction: done
Executing transaction: - 

    Installed package of scikit-learn can be accelerated using scikit-learn-intelex.
    More details are available here: https://intel.github.io/scikit-learn-intelex

    For example:

        $ conda install scikit-learn-intelex
        $ python -m sklearnex my_application.py

    

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

如果出现以下界面,那么恭喜你已经成功在Ubuntu系统里面安装上Anaconda啦,鼓掌撒花👏👏🎉🎉~,那么接下来就是进一步的学习和使用了。

no change     /usr/local/anaconda3/condabin/conda
no change     /usr/local/anaconda3/bin/conda
no change     /usr/local/anaconda3/bin/conda-env
no change     /usr/local/anaconda3/bin/activate
no change     /usr/local/anaconda3/bin/deactivate
no change     /usr/local/anaconda3/etc/profile.d/conda.sh
no change     /usr/local/anaconda3/etc/fish/conf.d/conda.fish
no change     /usr/local/anaconda3/shell/condabin/Conda.psm1
no change     /usr/local/anaconda3/shell/condabin/conda-hook.ps1
no change     /usr/local/anaconda3/lib/python3.10/site-packages/xontrib/conda.xsh
no change     /usr/local/anaconda3/etc/profile.d/conda.csh
modified      /root/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

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!

总结安装步骤:运行 bash Anaconda3-2023.03-1-Linux-x86_64.sh -p /usr/local/anaconda3 点击Enter(回车键),终端的下方会出现more一直回车,直到能提示需要输入yes/no,输入yes+继续回车+yes+回车,安装完成!
PS:Anaconda安装完成以后可能出现问题
1.提示找不到conda指令
最后一步选择了默认的no,然后在终端中输入conda,提示command not found,把它加到系统环境中解决方案是:

#将anaconda的bin目录加入PATH,根据版本不同,也可能是 /usr/local/anaconda3 
echo 'export PATH="/usr/local/anaconda3:$PATH"' >> ~/.bashrc
#更新bashrc以立即生效
source ~/.bashrc

运行就可以发现conda可以正常运行,通过conda -V来查看当前版本号:

root@interactive4805:/opt/data/private# source ~/.bashrc
(base) root@interactive4805:/opt/data/private# conda -V
conda 23.3.1

PS:Anaconda安装完成以后出现的个提示解读

1.For changes to take effect, close and re-open your current shell.,翻译过来就是:关闭当前命令行,并重新打开,刚刚安装和初始化Anaconda设置才可以生效,重新打开一个命令行后直接就进入了conda的base环境,如下:

(base) root@interactive4805:/opt/data/private#

2.If you’d prefer that conda’s base environment not be activated on startup, set the auto_activate_base parameter to false: ,翻译过来就是:如果您希望 conda 的基础环境在启动时不被激活,请将 auto_activate_base 参数设置为 false,命令如下:

conda config --set auto_activate_base false

当然这一条命令执行完毕后,想要再次进入conda的base环境,只需要使用对应的conda指令即可,如下:

conda activate base
  • 6
    点赞
  • 105
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Ubuntu 20.04安装Anaconda可以按照以下步骤进行操作: 1. 首先,从Anaconda官方网站下载适用于LinuxAnaconda安装包。 2. 打开终端,导航到下载的安装包所在的目录。 3. 运行以下命令来安装Anaconda: ``` bash Anaconda3-2021.05-Linux-x86_64.sh ``` 4. 在安装过程中,你需要接受安装协议。输入`yes`来接受协议。 5. 接下来,你将被要求阅读注册信息。输入`yes`来确认你已经阅读并同意注册信息。 6. 然后,你需要确定Anaconda安装位置。按`Enter`键接受默认位置。 7. 安装完成后,你将看到一条提示信息,询问是否将Anaconda添加到环境变量中。输入`yes`来添加。 8. 最后,你需要编辑`.bashrc`文件以添加Anaconda到环境变量中。运行以下命令: ``` sudo gedit ~/.bashrc ``` 9. 在打开的文件最后,添加以下两行命令: ``` export PATH="~/anaconda3/bin":$PATH source ~/anaconda3/bin/activate ``` 10. 保存并关闭`.bashrc`文件。 11. 重新启动终端,或者运行以下命令使修改的环境变量生效: ``` source ~/.bashrc ``` 现在,你已经成功在Ubuntu 20.04安装Anaconda。你可以在终端中运行`conda`命令来验证安装是否成功。 #### 引用[.reference_title] - *1* [Ubuntu20.04安装anaconda并默认激活conda base环境(步骤详细/操作简单实用)](https://blog.csdn.net/m0_52316372/article/details/124595809)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Ubuntu20.04安装anaconda](https://blog.csdn.net/abc20150125/article/details/129998028)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值