Reputation: 276
Is there a compile option for Python that will prevent the creation of the python3
symlink to the newly created binary?
I'm attempting to build and install multiple versions of python on a single system for usage with a CI system to run tests using multiple python versions. Specifically Python-3.6.6, Python-3.7.4, and Python-3.8.0.
The process for building and installing is below (assuming the source has already been downloaded and unpacked into /usr/src/python
):
cd /usr/src/python
./configure \
--prefix=/usr/ \
--build=x86_64-linux-gnu \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip
make -j "$(nproc)"
make install
When the above process is completed, I end up with the built binary (for example, /usr/bin/python3.7
for Python-3.7.8) but also a symlink from /usr/bin/python3
to that binary. Whichever version of python I install last overwrites the symlink to link to itself, regardless of what it linked to before:
My question is: is there a flag I can pass to either the configure
script or make that will disable creating this symlink entirely? I can create the symlink to the binary I want to be the "default" python3 version as part of my own setup process as I'd rather not rely on the install order to determine my default version.
I've looked through the python developer documentation but haven't been able to find a comprehensive list of the build arguments and documentation about what they do. This also isn't my area of expertise so I wasn't able to find what I was looking for in the source (but if someone could point me to it that would be much appreciated).
Upvotes: 2
Views: 2004
Reputation: 81654
make altinstall
is made exactly for that:
make install
can overwrite or masquerade the python3 binary.make altinstall
is therefore recommended instead ofmake install
since it only installsexec_prefix/bin/pythonversion
.
Upvotes: 4