Can't access packages of activated python environment

asked 2019-03-07 18:09:47 -0500

paul_shuvo gravatar image

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?

edit retag flag offensive close merge delete

Comments

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

gvdhoorn gravatar image gvdhoorn  ( 2019-03-08 02:30:15 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-08 02:30:27 -0500 )edit