问题
I have installed Anaconda 2.2.0 for Windows and created a virtual environment via:
> conda create -n my-env anaconda
The environment is sucessfully created and I see it in my list of envinronments (and indeed the directory is there in Anaconda\envs..)
> conda info -e
# conda environments:
#
my-env D:\Anaconda\envs\my-env
root * D:\Anaconda
However, when running the activate.bat script to switch envinronment, although it appears to be successful the switch isn't actually made:
> activate.bat my-env
Activating environment "astropy-dev"...
> conda list -e
# conda environments:
#
my-env D:\Anaconda\envs\my-env
root * D:\Anaconda
With the * indicating the active environment.
I have seen some issues with conda activate on Windows but haven't found this sepecific issue.
For further info: I am looking to copy the whole Anaconda package distribution and then install a dev version over one package.
回答1:
If you are using Powershell, activate currently does not support it. You will need to modify your PATH manually, or else use the cmd shell.
回答2:
Are you calling activate from within a batch script? Then it should be call activate my-env.
回答3:
You don't need the .bat. It's just activate my-env.
回答4:
You command
activate astropy-dev
must be run from the D:\Anaconda directory. Then it should work. To check, type:
conda info -e
来源:https://stackoverflow.com/questions/29863720/conda-virtual-environment-not-changing-under-windows