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
相关推荐
十日十行12 小时前
Linux和window共享文件夹
linux
AI探索者13 小时前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者13 小时前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python
FishCoderh15 小时前
Python自动化办公实战:批量重命名文件,告别手动操作
python
躺平大鹅15 小时前
Python函数入门详解(定义+调用+参数)
python
曲幽16 小时前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama
两万五千个小时19 小时前
落地实现 Anthropic Multi-Agent Research System
人工智能·python·架构
木心月转码ing19 小时前
WSL+Cpp开发环境配置
linux
哈里谢顿1 天前
Python 高并发服务限流终极方案:从原理到生产落地(2026 实战指南)
python
用户8356290780512 天前
无需 Office:Python 批量转换 PPT 为图片
后端·python