Git:使用conda命令切换虚拟环境

1. 问题

在win10电脑的Git中,无法使用conda list命令,报错(bash:conda:command not found)。也无法使用conda activate base命令激活虚拟环境,报错(bash:conda:command not found)。

2. 解决

1)解决在Git中使用conda命令的问题:配置环境变量。

2)解决无法使用【conda activate 环境名称】命令激活虚拟环境的问题。

输入conda init,然后重启Git bash。

复制代码
# 方式1:
source activate base          #1)先激活base
conda activate your_env_name  #2) 激活自定义的虚拟环境
conda deactivate              #3) 退出自定义的虚拟环境
 
# 方式2:
source activate your_env_name            #1)激活自定义的虚拟环境
source deactivate  或者 conda deactivate #2) 退出自定义的虚拟环境

方式1不可以的话就用方式2

相关推荐
素雨迁喜1 小时前
Linux平台下git工具的使用
linux·运维·git
Irene19913 小时前
Windows环境,VS Code 中 Git 配置指南
git·基础配置
Yang-Never4 小时前
AI Code -> Windows电脑安装Claude
开发语言·windows·git
Irene19914 小时前
2026 前端开发 Windows 安装 Git 配置指南(有实际安装过程参考:适配版本 the latest 2.53.0(2) x64 )
前端·windows·git
早起的年轻人5 小时前
告别Git仓库臃肿:一招解决Maven target目录误提交问题
java·git·maven
悠然大月季21 小时前
git 怎么导出提交历史,文件是乱码
git·git导出历史记录·git导出历史乱码
chenshiming8021 天前
在cursor下执行GIT回退版本
git
打点计时器1 天前
Git快速上手教程
git
我才是一卓1 天前
linux 安装简易 git 服务端并使用
linux·运维·git
王小义笔记1 天前
WSL(Linux)如何安装conda
linux·运维·conda