ubuntu安装Conda

在 Ubuntu 上安装 Conda 通常有两种方式:通过 Anaconda 分发版安装,或者仅安装 Miniconda。下面我将指导你如何通过这两种方式在 Ubuntu 上安装 Conda。

安装 Anaconda

下载 Anaconda 安装脚本

首先,访问 Anaconda 官方网站的下载页面,下载适用于 Linux 的 Anaconda 安装脚本。通常,下载链接为:

cd ~/Downloads 切换到工作目录下载安装脚本

wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh

运行安装脚本

通过以下命令使下载的脚本可执行,并运行它:

bash Anaconda3-2024.02-1-Linux-x86_64.sh

按照屏幕上的提示完成安装,同意许可协议,选择安装位置(默认通常即可),并决定是否将 Anaconda 的 bin 目录添加到你的 PATH 环境变量中。

Anaconda3 will now be installed into this location:
/root/anaconda3

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

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

installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
   run the following command when conda is activated:

conda config --set auto_activate_base false

You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes
no change     /root/anaconda3/condabin/conda
no change     /root/anaconda3/bin/conda
no change     /root/anaconda3/bin/conda-env
no change     /root/anaconda3/bin/activate
no change     /root/anaconda3/bin/deactivate
no change     /root/anaconda3/etc/profile.d/conda.sh
no change     /root/anaconda3/etc/fish/conf.d/conda.fish
no change     /root/anaconda3/shell/condabin/Conda.psm1
no change     /root/anaconda3/shell/condabin/conda-hook.ps1
no change     /root/anaconda3/lib/python3.11/site-packages/xontrib/conda.xsh
no change     /root/anaconda3/etc/profile.d/conda.csh
modified      /root/.bashrc

更改环境配置

source /root/.bashrc

验证安装

安装完成后,重启终端会话(或者重新登录),然后输入以下命令来验证 Anaconda 是否正确安装:

conda list

Miniconda版本也类似Anaconda的安装


配置 Conda

安装完成后,你可能需要配置 Conda 以使用额外的频道,如 conda-forge,来获取更多软件包。你也可以通过以下命令更新 Conda 到最新版本:

conda update conda

此外,确保你的 shell 配置文件(如 .bashrc 或 .zshrc)包含了 Conda 的 bin 目录,这样你就可以在任何终端会话中使用 Conda 命令了。如果安装过程中没有自动添加到 PATH,你可以在配置文件中手动添加以下行:

export PATH="/path/to/anaconda3_or_miniconda3/bin:$PATH"

替换 /path/to/anaconda3_or_miniconda3 为实际的安装路径。

以上步骤将帮助你在 Ubuntu 上成功安装和配置 Conda。

配置自定义的python环境

conda create -n python39 python=3.9

切换到自定义的python环境

conda activate python39

在自定义环境下安装需要的组件,开始你的python世界遨游吧

  • 22
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值