无法激活 Conda 环境

FiR*_*iTi 3 anaconda miniconda

我安装了 miniconda 并创建了一个环境:

conda create --prefix /path/to/a/directory/Python36 python=3.6
Run Code Online (Sandbox Code Playgroud)

然后我尝试激活它:

conda activate /path/to/a/directory/Python36
Run Code Online (Sandbox Code Playgroud)

但我收到此错误消息:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Run Code Online (Sandbox Code Playgroud)

但是当我运行时condo init --all,我没有任何变化,一切都已经初始化。

...
No action taken.
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

pyl*_*ang 7

通常您按名称激活环境:

> activate myenv
Run Code Online (Sandbox Code Playgroud)

Mac/Linux 用户拥有> source activate. 较新的 conda 版本可能会使用> conda activate.

在您的情况下,您的环境名称是什么?您可以列出现有环境

> conda env list
Run Code Online (Sandbox Code Playgroud)

如果您发现root或以外的环境base,请按上述方式激活它。

将来,请考虑创建具有名称的环境,以便以后轻松访问:

> conda create -n myenv ... python=3.6
> activate myenv
Run Code Online (Sandbox Code Playgroud)

注意:...表示任意可选标志。

  • 谢谢,关键是使用 `source activate` 而不是 `conda activate`。而且我无法使用名称,因为我需要指定一个特定的安装目录。 (4认同)