What exactly does ./configure --enable-shared do during python altinstall?

前端 未结 3 879
感动是毒
感动是毒 2021-01-31 11:24

When I altinstall python 2.7.12 with

./configure --prefix=/opt/python --enable-shared

it comes up as python 2.7.5 (system default python

3条回答
  •  情深已故
    2021-01-31 11:26

    With ldd comand you can view where the executable is searching for libraries:

    ldd python2.7
        linux-vdso.so.1 =>  (0x00007fffa75ec000)
        libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f717042e000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7170211000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f716fe46000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f716fc2c000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f716fa28000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f716f824000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f716f51b000)
        /lib64/ld-linux-x86-64.so.2 (0x000055969d00b000)enter code here
    

    You can change the lib search path of python2.7 setting LD_LIBRARY_PATH variable in the environment (non-persistent):

    export LD_LIBRARY_PATH=/opt/python/lib
    

    or setting a persistant system-wide way:

    echo "/opt/python/lib" > /etc/ld.so.conf.d/python.conf
    ldconfig -v
    

    or setting a persistent executable way:

    patchelf --set-rpath /opt/python/lib/ python2.7
    

提交回复
热议问题