ubuntu 安装 anaconda

ubuntu 安装 anaconda

  1. 下载

    bash 复制代码
    wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
  2. 安装

    bash 复制代码
    bash Anaconda3-2023.09-0-Linux-x86_64.sh

    2.1 回车继续

    2.2 许可协议

    输入 q 退出阅读许可协议

    2.3 输入 yes 接受 许可协议

    2.4 设置 anaconda 安装位置 如不需要更改直接回车

    2.5 安装完成是否激活 conda 环境

    如果选择激活 conda 环境 输入 yes 回车即可,后面是步骤不需要执行

    如果选择不激活 conda 环境,按需激活相应的虚拟环境 输入 no

  3. 查看当前默认 shell

    bash 复制代码
    echo $SHELL
  4. 确认 shell 类型

    bash 复制代码
    eval "$(/home/lhz/anaconda3/bin/conda shell.bash hook)"
  5. 激活 conda

    bash 复制代码
    conda init
  6. 验证

    bash 复制代码
    conda env list
  7. 启动时不进入 conda 的 base 环境,按需激活相应的虚拟环境

    bash 复制代码
    vim ~/.bashrc

    最后一行追加以下内容:
    不推荐

    bash 复制代码
    # 不推荐
    conda config --set auto_activate_base false

    推荐

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

    使环境变量生效

    bash 复制代码
    source ~/.bashrc
  8. 修改国内镜像源

    8.1 查看当前镜像源

    bash 复制代码
    conda config --show channels

    8.2 添加国内清华镜像源

    bash 复制代码
    conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
    conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
    conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

    8.3 设置检索路径

    bash 复制代码
    conda config --set show_channel_urls yes

    8.4 再次查看当前镜像源

    bash 复制代码
    conda config --show channels

    8.5 移除默认镜像源

    bash 复制代码
    conda config --remove channels defaults

    8.6 镜像源配置文件

    镜像源配置文件保存在当前用户主目录下的 .condarc 文件中

    我的配置文件路径 /home/lhz/.condarc

    bash 复制代码
    auto_activate_base: false
    channels:
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    show_channel_urls: true
  9. 升级 conda

    bash 复制代码
    conda update -y conda
相关推荐
星恒随风11 分钟前
MySQL 从零入门(三):表的约束详解
linux·服务器·数据库·笔记·mysql
Alluxio1 小时前
Alluxio + OCI:为 AI 工作负载实现亚毫秒访问延迟与可扩展吞吐
运维·数据库·人工智能·分布式·缓存·ai·语言模型
卷无止境1 小时前
mathmodel-figure-templates 以及两个上手案例
后端·python
锋行天下2 小时前
服务器 Python 2.7 装不了 langgraph-cli?用本地生成 Dockerfile 曲线救国
人工智能·后端·python
一条大祥脚2 小时前
深入理解 PyTorch FlexAttention:从 Score Mod 到 Mask Mod 的稀疏加速之道
人工智能·pytorch·python·注意力机制·flex attention·可编程注意力
StarsGreen2 小时前
libva在intel平台上的前端流程简介
linux
2601_967980113 小时前
Python自动化办公:模块、库与样式调整教程
python·excel·自动化办公·openpyxl·样式调整
长沙三为智能科技3 小时前
GEO与传统SEO的5个关键差异:排名与被引用、关键词与答案型的全维度对比
python·aigc·seo·ai搜索·geo优化
量化分析码农5 小时前
【Python量化趋势跟踪实战 02】突破买入总被假突破坑:通道系统与入场时机
python
Agent世界5 小时前
多平台登录态巡检:cookie 判据为什么会撒谎
python