我在 Windows 上安装了 Git-Bash 和 conda,它提供了两个程序:C:\Program Files\Git\git-bash.exe
and 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'.
I tried conda init
and conda init bash
,然后关闭并重新打开bash.exe
,但它仍然保持不变。
关于如何解决这个问题有什么想法吗?
可能的解决方法:
我担心这个问题,因为 VSCode 的集成终端使用它。我尝试使用C:\Program Files\Git\git-bash.exe
作为集成终端,但它会打开一个新窗口,而不是 VSCode 中的“集成”。
The git-base.exe
与 conda 配合良好,因此有关如何设置的指南git-base.exe
VSCode集成终端也是可以的。
任何帮助,将不胜感激。
对我来说有两个问题:
-
conda init
创建一个.bash_profile
文件具有正确的初始化,但是git-bash.exe
loads .bashrc
(谢谢Auss https://stackoverflow.com/questions/58388190/conda-init-doesnt-work-in-bash-on-windows#comment107520003_58388190' 评论)
- 我的 bash 主目录不等于我的 Windows 主目录。康达创建
C:\Users\<username>\.bash_profile
和 bash 需求~/.bashrc
, but ~/
不等于C:\Users\<username>\
.
我的解决方案是
- run
code ~/.bashrc
从 VS Code 中的 git 终端确保.bashrc
在正确的位置创建
- 复制内容
C:\Users\<username>\.bash_profile
并粘贴到打开的.bashrc
- 重新打开 Git 终端
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)