Cartucho
Cartucho

Reputation: 3329

virtualenv + apt-get confusion

I've started using virtualenv and I have a doubt, any hint will be welcome.

This is my scenario:

  1. I active virtualenv and install a package XXX (using apt-get) that deploy some python stuff in my virtualenv/site-packages.

  2. Deactivate virtualenv

  3. Run apt-get upgrade XXX

What happen in this case with the XXX's python stuff? It's installed in the global site-packages? Can something be broken?

Sorry if it's a silly question, but deployment of python packages is a bit blur for me :/

Upvotes: 0

Views: 644

Answers (1)

Thomas Orozco
Thomas Orozco

Reputation: 55253

Using apt-get, packages will always get installed system-wide, not in the virtualenv. This, regardless of whether a virtualenv is currently active.

In your case, that means that the package is installed system-wide in 1, and that install is upgraded in 3.

If you want to install something in the virtualenv, the closer you can get to apt-get is using pip:


Example:

virtualenv ENV
source ENV/bin/activate
pip install django 

Django is now installed in the virtualenv at ./ENV, but not system-wide.

Conversely, doing: apt-get install python-django would install it system-wide, but not in the virtualenv.

Upvotes: 5

Related Questions