-1

I wrote a Python script which uses a package named paraview. I installed this package to my environment. I want that whenever the code is run, the environment must be changed and then the code is run.

I added the following command at the beginning of the code but it didn't work.

import os
os.system("conda activate <env. name>") 

I get following error:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

To initialize your shell, run
$ conda init <SHELL_NAME>

I tried the solution given at How to activate conda environments while still being able to change the environment with eval --setenvironment but couldn't get any result.

Is there any way to do this?

2
  • Did you run conda init <shell_name>? – George Udosen Dec 26 '19 at 7:03
  • Yes, I run that. It gives; No action taken. – Yusuff Dec 26 '19 at 7:11
0

In your code:

import os
os.system("conda activate <env. name>")

Use source activate instead of conda activate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.