How to choose an exOS interpreter and environment?

Hello, everyone.
I get an error when I impot cv2 library in my exOS python program,
how should I choose the environment for exOS program compilation.

I’ve installed numoy in the exOSTarget .

Hi @mar ,

This behavior comes from the fact that you have installed numpy for your user, and the exOS services run as root.

A simple means of testing this on the target is to try the command as root or as sudo. meaning either

su
python /path/to/your/script.py

or

sudo python /path/to/your/script.py

should produce the same problem, which gives you a simple means of testing before deploying when using additional libraries.

There are a lot of references on the web to solve this, whereas the general recommendation is to use virtual environments.

The simplest way, although not generally recommended (because it can create version conflicts between packages used by different users) is to install the numpy system wide. If you are “alone” on your target (which I assume), then you can go with:

su
pip install numpy

or

sudo pip install numpy

Again, theres a lot of public information in this topic, and several ways to solve this properly, which I would recommend digging deeper into.

If you are new to exOS, please have a look at the getting started:

happy coding

2 Likes

Hi @mar,

did you already tried with the command sudo apt install python3-opencv ?

1 Like

Thank you very much for your explanation, it replied my doubts very well and I will read the guidance you mentioned again in detail

1 Like

Hi @vanessaca
I’m not currently installing via sudo, I’ll give it a try here, thanks for the reply!

Hi @patric.thysell
Thank you very much for your explanation, it replied my doubts very well and I will read the guidance you mentioned again in detail.