创建Conda环境MyDjangoEnv后激活失败,重新创建也报错求助
Let's break down your two issues one by one and fix them step by step:
source activate MyDjangoEnv throws "No such file or directory" This usually happens for one of a few reasons—let's troubleshoot:
First, confirm if your
MyDjangoEnvenvironment actually exists. Run this command to list all Conda environments on your system:conda env listIf
MyDjangoEnvdoesn't show up in the output, your initial environment creation must have failed. We'll fix the second issue first so you can create it properly.If the environment does exist, newer Conda versions (4.4 and above) have deprecated
source activatein favor of a simpler command. Try activating the environment with:conda activate MyDjangoEnvIf
conda activatestill doesn't work, your shell might not be initialized to recognize Conda commands. Run the init command for your specific shell, then restart your terminal:- For Bash:
conda init bash - For Zsh:
conda init zsh
After reopening your terminal, try activating the environment again.
- For Bash:
conda create --name MyDjangoEnv python=3 throws "conda: the order was not found" This error looks like either a typo or a problem with your Conda installation. Here's how to fix it:
First, double-check your command for typos. The valid command (you can use either
--nameor the shorthand-n) is:conda create --name MyDjangoEnv python=3Or the shorter, more common version:
conda create -n MyDjangoEnv python=3If you misspelled
createor another keyword, that would trigger an error like the one you saw.If the command is correct, Conda might not be properly added to your system's PATH. Try running Conda using its full executable path (find this with
which condaon Linux/macOS orwhere condaon Windows). For example:/home/your-user/miniconda3/bin/conda create -n MyDjangoEnv python=3If neither of the above works, your Conda installation could be corrupted. Try reinstalling Miniconda or Anaconda, and make sure to check the "Add Conda to system PATH" option during setup (this is crucial for Conda to work from any terminal window).
内容的提问来源于stack exchange,提问作者user9608539

