How do you recompile python in virtual env with --enable-shared
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
.
source to share