Robotics StackExchange | Archived questions

Can't access packages of activated python environment

My code doesn't run without the #!/usr/bin/python shebang, it throws error

import: command not found.

But I want to run it for other conda environment. When I run the code doesn't matter which conda env I activate it still fetches the system python's old packages e.g. opencv 2.4.8 whereas I want to use 4.0.0

I understand it probably because of that shebang, but is there any way to use other python envs as a default interpreter? Is it possible to use ros with distinct conda/python environment?

Asked by paul_shuvo on 2019-03-07 19:09:47 UTC

Comments

Wouldn't the correct shebang be: #!/usr/bin/env python? That should pick up whatever the system considers the default Python interpreter.

Asked by gvdhoorn on 2019-03-08 03:30:15 UTC

Is it possible to use ros with distinct conda/python environment?

Possible? Yes. Straightforward? No. You're going to have to install all Python pkgs in each Python env, unless you want to manually change the PYTHONPATH in each.

Asked by gvdhoorn on 2019-03-08 03:30:27 UTC

Answers