A relocatable (self-contained) Python built from the original tarball inside a virtual environment?

I looked through the documentation virtualenvand found qaru.site/questions/481014 / ... . However, no answer to my question, or I may be missing something, so I ask.

How to create an environment virtualenvthat contains python, which does not depend on the (system-wide) pythonof the "host"? That is, I want completely standalone virtualenvwith my own Python 2.7 compiled from the source. Another property would be important: since it virtualenvdoes not coincide with chroot, pythonit virtualenvmust cope with various absolute paths inside .

I find that the closest thing to what I want is virtualenv --relocatablewith my own Python installation inside.

How can i achieve this?

Justification

I have some old Linux boxes with various versions of Python offered through the package manager. The administrator will not allow me to create more recent Python in the boxes, so I need to be able to install Python from the source in the limited environment in which I have it.

Properties I need:

  • virtualenv the environment should be completely autonomous (full Python with all libraries, etc.)
  • python inside should work regardless of its absolute path when deployed
    • I know it $ENV/bin/pythonseems to be doing this, but it also relies on pythonbeing installed on a system scale. I want to completely disable this dependency by flipping my own Python.
  • virtualenv --relocatable, Python.

, :

  • /. , virtualenv ( Linux).
+5
1
  • python
  • ./configure --prefix=/dest
  • make && make install

, ​​ python, python /dest. , , "relocatable".

python, /dest/bin PATH .

, virtualenv python...

+7

All Articles