Thursday, 27 April 2017

How to activate a Conda Environment from the "sh" shell (on Nodejs)?

I can activate the Conda Environment with any problems from the bash shell. I can use this two options on bash:

source activate env_name
. activate env_name

But I am using the method exec of Node to run the activation of the environment. Node uses sh shell in order to run commands. So I had to use this command to run the environment because the options above did not work.

const child_process = require('child_process')
child_process.exec('bash -c "source activate env_name"')

Is there a better way to do this?

Note: I am using Ubuntu 16.10



via ChesuCR

No comments:

Post a Comment