Conda environments and .BAT files

Use the 'call' command when activating/deactivating the environment.

call activate [my_env]
python my_script.py
call conda deactivate

See https://github.com/conda/conda/issues/794


Are you sure you need a batch file? I think this should work.

cmd "/c activate [my_env] && python my_script.py && deactivate"

When I made a simple file containing

print("Hello")

Which I called myprint.py and ran

cmd "/c activate anaconda33 && python myprint.py && deactivate"

This worked for me. You could also put this in a one line batch file.