Why use Pythons virtualenv on Linux if you have chroot (and merged / overlay file systems)?

First of all, let me say that I am a supporter of general software (in general ;-). I am not a Python expert, but it seems that the virtualenv utility solves almost the same problem that chroot can help solve - a bootable directory tree that can be passed as root, thereby effectively protecting the real directory tree if necessary.

Since I am not an expert in Python, as already mentioned, I wonder - what problem can virtualenv solve, what can chroot not? I mean, can I just create a beautiful fake root tree (possibly with a mount), chrootinto it and make the pip installpackage that I want in my new environment, and then play within my new environment, running python scripts, and what not?

Did I miss something?

Update:

Is it possible to install packages / modules locally in any application directory, I mean, without root privileges and subsequently without overwriting or adding files to /usr/libor /usr/local/lib? It seems like this is what virtualenv does, however I think it should symbolically or otherwise provide a python interpreter for each environment being created, right?

+4
source share
1 answer

a bootable directory tree that can be passed as root

This is not what virtualenv does, except (to some extent) for Python packages. It provides a place where they can be installed without replacing the rest of the file system. It also works without root privileges and is portable because it does not need kernel support, unlike chroot, which (I suppose) will not work on Windows.

You cannot install packages / modules locally in any application directory

, virtualenv , , ( ) Python. , , (, , ), , . , .

+6

All Articles