Compile Python 2.7.3 from source in a system with Python 2.7 already

I want to compile Python 2.7.3 from source code. OS - OpenSUSE 11.4 x86_64, which already provides Python 2.7. I would like to use 2.7.3 for the latest security fixes, but this is a general system, so I cannot work with the Python system interpreter.

I will compile with ./configure --prefix=/opt/python --enable-shared . There are no configuration errors, so I make . Again no errors. I do a make install (I don’t think I need to make altinstall , since this installation prefix is ​​not used in /opt/python yet).

When I try to run the new binary /opt/python/bin/python , Python declares its version as 2.7, not 2.7.3. The only thing I found to fix this was to move the system /usr/lib64/libpython2.7.so.1.0 and symbolically bind it to /opt/python/lib/python/libpython2.7.so.1.0 . This works, and Python announces that it is 2.7.3, but it breaks up the Python system.

In any case, I can make them coexist, for example. getting /opt/python to use your own libpython? Except for the delivery of LD_LIBRARY_PATH at run time. Is there a compilation solution? Thanks.

+6
source share
1 answer

To avoid specifying the runtime library path with LD_LIBRARY_PATH every time you start Python, you can specify it at build time using the -rpath linker option:

 ./configure --enable-shared --prefix=/opt/python \ LDFLAGS=-Wl,-rpath=/opt/python/lib 
+15
source

Source: https://habr.com/ru/post/926051/


All Articles