how to make python load dylib on osx

后端 未结 1 1360
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-19 07:42

Trying to load a shared lib out of the current \'.\' dir in a unit test on osx.

What works on Linux and Netbsd there is a symlink _mymodule.so --> ../.libs/

相关标签:
1条回答
  • 2020-12-19 07:54

    Just use *.so as your module extensions in OS X too. I have a vague memory of not being able to load .dylib's and it turning out to be an issue with python itself. . . but I can't find the mailing list post now.

    However, rest assured you're following standard practice by using *.so's even on OS X. The only *.dylib's in the entire framework are the libsvn_swig ones.

    find /System/Library/Frameworks/Python.framework/Versions/2.6/ -name "*.so"
    
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/X11/xcb/xcb.0.0.0.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/X11/xcb/xcb.0.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/X11/xcb/xcb.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/CoreGraphics/_CoreGraphics.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/OpenSSL/SSL.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/OpenSSL/crypto.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/OpenSSL/rand.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_appmain.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_carbon.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_inlines.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nsbezierpath.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nsbitmap.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nsfont.so
     /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nsquickdrawview.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nsview.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/AppKit/_nswindow.so
    /System/Library/Frameworks/Python.framework/Versions/2.6//Extras/lib/python/PyObjC/CFNetwork/_manual.so
    
    0 讨论(0)
提交回复
热议问题