Mustafa
Mustafa

Reputation: 129

I want my already created virtualenv to have access to system packages

I've recently installed opencv3 on ubuntu 14.04. The tutorial I followed was for some reason using a virtualenv. Now I want to move opencv from the virtual to my global environment. The reason for this is that I can't seem to use the packages that are installed on my global environment which is getting on my nerves. So how can I do that?

Upvotes: 1

Views: 1307

Answers (1)

poros
poros

Reputation: 406

I'm not sure I got your question right, but probably your virtualenv has been created without specifying the option --system-site-packages, which gives your virtualenv access to the packages you installed system-wise.

If you run virtualenv --system-site-packages tutorial_venv instead of just virtualenv tutorial_venv when creating your tutorial virtualenv, you might be fine.

Fyi, using a virtualenv with only local dependencies it's a fairly widespread practice, which:

  • gives you isolation and reproducibility in production scenarios
  • makes possible for users without the privilege of installing packages system-wide to run and develop a python application

The last benefit might be the reason why your tutorial suggested a virtualenv based approach.

Upvotes: 5

Related Questions