How do you recompile python in virtual env with --enable-shared

Once I made my virtualenv Python was already installed. How do I add an option --enable-shared

? Do you want to uninstall it or start virtualenv from fresh ones? If I do this, how do I add a Python parameter? I don't want to confuse anything.

+3


source to share


1 answer


When creating a virtual environment, the Python binaries will be copied, not compiled. Quoting from the venv

documentation
,

It also creates a bin (or Scripts in Windows) subdirectory containing a copy of the python binary (or binaries in the case of Windows)

But it --enable-shared

is an option to the ./configure

script that is used when compiling Python from source.



So, you first need to compile Python from source with an option --enable-shared

, and then create a virtual environment with the compiled python binaries.

If you are using a UNIX based OS, the default installation will be in a directory /usr/local

so you don't mess up your current Python installation.

Also, sudo make install

use instead sudo make altinstall

. This will install Python with the format major.minor

.

+3


source







All Articles