Activate Conda Environment in Python Script

I am converting a shell script to Python, and I am looking for a way to activate and deactivate a conda environment programmatically in Python. I looked at Conda code on Github and did not find a good solution.

I need the environment to be activated so that I can run several statements in it. For instance:

source activate my_env easy_install numpy backup_db initialize_db source deactivate 

I had no luck using the subprocess .: - (

+5
source share
1 answer

A round way to do this, but could you not have python just call the script directly?

Refer to this question on how to do this.

Run the .bat file using python code

+1
source

Source: https://habr.com/ru/post/1271081/


All Articles