Cython unable to find shared object file

后端 未结 2 1868
青春惊慌失措
青春惊慌失措 2021-01-13 13:25

I am trying to link to my own C library from Cython, following the directions I\'ve found on the web, including this answer:

Using Cython To Link Python To A Shared

2条回答
  •  既然无缘
    2021-01-13 14:12

    I'm self-answering, in case anyone else runs into the same problem. Looks like the answers are here:

    Set LD_LIBRARY_PATH before importing in python

    Changing LD_LIBRARY_PATH at runtime for ctypes

    According to these answers (and my experience), the linker reads LD_LIBRARY_PATH when python is launched, so changing it from within python doesn't have any useful effect, at least not the effect I was hoping for. The only solution is to either wrap python in a shell script that sets LD_LIBRARY_PATH, or else drop the shared object somewhere on the linker search path.

    Kind of a pain, but it is what it is.

提交回复
热议问题