ubuntu安装conda

即刻关注,获取更多

在这里插入图片描述

实现目标

在 ubuntu 系统下安装 conda

参考资料

anaconda安装参考文档: https://docs.anaconda.com/free/anaconda/install/linux/

环境说明

系统环境: Ubuntu 22.04.3 LTS
安装用户使用 root 用户安装
安装版本 Anaconda3-2024.02-1
安装路径 /opt/anaconda3

安装步骤

  1. 下载 Anaconda3-2023.09-Linux-x86_64.sh
# Replace <INSTALLER_VERSION> with the version of the installer file you want to download
# For example, https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
# All installers can be found at repo.anaconda.com/archive/
curl -O https://repo.anaconda.com/archive/Anaconda3-Anaconda3-2024.02-1-Linux-x86_64.sh
  1. 安装
bash Anaconda3-2023.09-Linux-x86_64.sh

# 成功后输出

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 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] >>> no

You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:

eval "$(/opt/anaconda3/bin/conda shell.YOUR_SHELL_NAME hook)"

To install conda's shell functions for easier access, first activate, then:

conda init



# 静默安装
bash Anaconda3-2024.02-1-Linux-x86_64.sh -b -p /opt/anaconda3 -f

  1. 配置

cd /opt/anaconda3

./bin/conda init bash
cat .bashrc

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

回退 参考 ./bin/conda init --reverse bash

conda config --set auto_activate_base false

cat ~/.condarc

auto_activate_base: false

pkgs_dirs:
  - /data/anaconda3/pkgs
  - /opt/anaconda3/pkgs

envs_dirs:
  - /data/anaconda3/envs
  1. 创建环境
 conda create --name hello python=3.8

conda activate hello
conda deactivate

conda env remove --name hello
  1. 其他命令

conda env list

conda list
conda info
conda search

多环境问题解决

问题:前文说道我的安装用户是root, 安装后 conda env list 显示的是 还有其他用户创建的环境,看着有点奇怪,想去掉,但是不能影响其他用户

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jack_software

感谢打赏,我努力提供优质内容~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值