I have looked at the virtualenv
documentation and also found this question here at StackOverflow. However, neither answer my question or I may be missing something, so I am asking.
How can I create a virtualenv
environment which contains a python
that doesn't depend on the (system-wide) python
of the "host"? I.e. I want a fully self-contained virtualenv
with its own Python 2.7 compiled from source. Another property would be important: since virtualenv
isn't the same as chroot
the python
inside the virtualenv
has to cope with different absolute paths.
I reckon the closest to what I want is a virtualenv --relocatable
with its own Python installation inside.
How can I achieve that?
I have some older Linux boxes with different versions of Python offered through the package manager. The admin won't allow me to build a more recent Python on the boxes, so I need to be able to install a Python from source into the constrained environment I have.
virtualenv
environment should be fully self-contained (complete Python with all libraries etc)python
inside should work regardless of its absolute path when deployed
$ENV/bin/python
seems to do that, but it also seems to rely on the python
installed system-wide. I want to cut this dependency out completely, rolling my own Python.virtualenv --relocatable
but needs to contain a full Python installation as well.virtualenv
environment will be built for each platform (currently only various Linux distros)../configure --prefix=/dest
make && make install
congratulations, you now have a python installation that's completely independent of the system python in /dest
. Moving this directory shouldn't be a problem, if that's what you mean with 'relocatable'.
To use this installation instead of the system python, just make sure to put /dest/bin
on the PATH
before the standard locations.
If that's not enough for you, you can setup a virtualenv using this python installation...