Problems installing Python 3 with --enable-shared

后端 未结 2 1731
名媛妹妹
名媛妹妹 2021-01-01 05:07

Problem

I\'m trying to install Python 3 with the --enable-shared option. Installation \"succeeds\" but the resulting Python is not runnable. Trying to run Python a

相关标签:
2条回答
  • 2021-01-01 05:19

    As explained in the mod_wsgi documentation, set LD_RUN_PATH at the time of installing mod_wsgi.

    • http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html?highlight=ld_run_path#unable-to-find-python-shared-library
    0 讨论(0)
  • 2021-01-01 05:27

    I've repeated your steps on CentOS7 and get something similar:

    $ /tmp/py3/bin/python3
    /tmp/py3/bin/python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
    

    If you look at the linking of python, it isn't providing a full path to the library:

    $ ldd /tmp/py3/bin/python3
        linux-vdso.so.1 =>  (0x00007fff47ba5000)
        libpython3.5m.so.1.0 => not found
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdfaa32e000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fdfaa12a000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007fdfa9f27000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fdfa9c24000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fdfa9862000)
        /lib64/ld-linux-x86-64.so.2 (0x000055e85eac5000)
    

    For some reason, the Python build process isn't adding -rpath to the link line, which would "add a directory to the runtime library search path."

    If you explicitly set your library path, it will work:

    $ LD_LIBRARY_PATH=/tmp/py3/lib/ /tmp/py3/bin/python3
    Python 3.5.1 (default, Jun 10 2016, 14:54:59) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    

    So now it becomes a question as to whether you want to:

    • set LD_LIBRARY_PATH globally on your system
    • Edit /etc/ld.so.conf (or /etc/ld.so.conf.d/*)
    • Use chrpath to change the embedded path
    • export LD_RUN_PATH={prefix}/lib before you run configure and make (Where {prefix} is what you passed to --prefix. You used the wrong path.)
    0 讨论(0)
提交回复
热议问题