ubuntu系统在bashrc文件中对conda进行启用设置

一、打开bashrc文件

bash 复制代码
vim ~/.bashrc

二、对于conda的设置

设置段落定义如下,设置为 true为开启使用 conda。

bash 复制代码
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if true; then  # 整段屏蔽,ROS 时不用 conda
__conda_setup="$('/home/admin1/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/admin1/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/admin1/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/admin1/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
fi
# <<< conda initialize <<<

设置为 false为停止使用 conda。

bash 复制代码
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if false; then  # 整段屏蔽,ROS 时不用 conda
__conda_setup="$('/home/admin1/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/admin1/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/admin1/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/admin1/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
fi
# <<< conda initialize <<<

设置完成后,激活环境参数。

bash 复制代码
source ~/.bashrc
相关推荐
默_笙1 天前
🍙 给每个请求过安检:FastAPI 是怎么把校验写进类型注解的
python
未济1 天前
linux 配置环境变量
linux
傲世仙尊1 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
qq_426003961 天前
启动playwright录制codegen生成自动化测试脚本
python·自动化
虎头金猫1 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
长沙三为智能科技1 天前
家政小程序开发从0到上线:五阶段交付流程与验收清单
python
伞伞悦读1 天前
【第38期】Python 模块与包详解:import、from、模块搜索路径、包结构和 __init__
开发语言·python
只睡四小时1 天前
Canvas 弹道联机实战:700 行 + 固定时间步长
python·websocket·html5·游戏开发·canvas
_艾伦 耶格尔.1 天前
进程间通信
linux
AI职业加油站1 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展