使用 WSL Windows 10 中的 conda

jgr*_*gr0 6 ubuntu cygwin conda windows-10 windows-subsystem-for-linux

我已经安装conda在我的 Windows 10 环境中。当我尝试从我的 Ubuntu WSL 使用 conda 时,它抛出:

CommandNotFoundError:您的 shell 尚未正确配置为使用“conda activate”。如果您的 shell 是 Bash 或 Bourne 变体,请为当前用户启用 conda

$ echo ". C:\ProgramData\Miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我的 bash 在重新启动时抛出错误:

cygpath: command not found

-bash: /etc/profile.d/conda.sh: No such file or directory

我应该安装 Cygwin 以在 WSL 中使用 conda 吗?

sam*_*sam 2

WSL 将安装在您计算机上的主用户下。但是您无法从 WSL 使用 Conda(安装在 Windows 中)。

但是,您始终可以在 WSL 中安装 python 并使用 Windows 文件系统中的代码。它将位于 /mnt 路径中。