我在我的视窗上安装了Git-Bash和conda,它提供了两个程序:C:\Program Files\Git\git-bash.exe
和C:\\Program Files\\Git\\bin\\bash.exe
。
后者,C:\\Program Files\\Git\\bin\\bash.exe
,不能与conda一起正常工作。当我尝试conda acitvate base
时,我得到一条消息:
Administrator@##### MINGW64 /bin
$ conda --version
conda 4.7.12
Administrator@##### MINGW64 /bin
$ conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
我尝试了conda init
和conda init bash
,然后关闭并重新打开bash.exe
,但它仍然是一样的。
有没有办法解决这个问题?
可能的解决方法:
我之所以关注这个问题,是因为VSCode的集成终端使用它。我尝试使用C:\Program Files\Git\git-bash.exe
作为集成终端,但它打开了一个新窗口,而不是VSCode中的“集成”。
git-base.exe
与conda一起工作良好,因此如何将git-base.exe
设置为VSCode集成终端的指南也是可以接受的。
任何帮助都将不胜感激。
发布于 2021-01-28 16:33:59
对我来说有两个问题:
conda init
创建了一个具有正确初始化的.bash_profile
文件,但git-bash.exe
加载了.bashrc
(感谢Auss的注释)C:\Users\<username>\
.创建了C:\Users\<username>\.bash_profile
,bash需要~/.bashrc
,但是~/
不等于Conda
我的解决方案是
code ~/.bashrc
,确保在C:\Users\<username>\.bash_profile
的内容中正确创建了.bashrc
,并将其粘贴到打开的.bashrc
发布于 2021-08-03 08:13:00
将.bash_profile中的配置追加到.bashrc文件中
conda init bash
cat ~/.bash_profile >> ~/.bashrc
conda activate $ENVNAME
在bash重启后应该可以工作。
发布于 2022-03-03 00:55:12
https://stackoverflow.com/questions/58388190
复制相似问题