📅  最后修改于: 2023-12-03 14:40:10.188000             🧑  作者: Mango
When working with the Anaconda distribution of Python, you may encounter the error message "CommandNotFoundError: Your shell is not properly configured to use 'conda activate'" when trying to activate a conda environment.
This error occurs because your shell is not configured to make use of the 'conda activate' command. By default, Anaconda installs a conda shell initialization script that should be run to configure your shell to use conda.
To fix the issue, follow these steps:
Open a new terminal window
Run the following command to locate the conda initialization script:
conda init <SHELL_NAME>
Replace SHELL_NAME with the name of your shell (e.g. bash, zsh, fish). If you're unsure of your shell name, you can check by running echo $SHELL
in your terminal.
After running the conda init
command, exit your terminal and open a new one.
Verify that conda is now properly installed by running conda activate <ENV_NAME>
, where ENV_NAME is the name of an existing conda environment.
By following these steps, you should be able to properly use the 'conda activate' command and work with conda environments in your shell.