ctypes find_library不参考LD_library_PATH?

2024-05-14 09:21:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在Linux上使用基于ctypes的包装器,它安装在非标准路径中。但是:

----> 1 import librsync
/home/ptest/lib/python2.7/site-packages/librsync/__init__.py in <module>()
     11     path = ctypes.util.find_library('rsync')
     12     if path is None:
---> 13         raise ImportError('Could not find librsync, make sure it is installed')
     14     try:
     15         _librsync = ctypes.cdll.LoadLibrary(path)

ImportError: Could not find librsync, make sure it is installed 

LD_LIBRARY_PATH已预先设置,但ctypes似乎不支持它。这项调查提出了许多问题,但我似乎找不到解决办法。有什么帮助吗?在


Tags: installedpath路径makeislinuxnotit
2条回答

从Python3.6开始,it does。在

对于早期版本,@eryksun suggested此解决方法:

os.environ['LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH']

在此之前执行此操作:

sudo apt-get install librsync-dev

相关问题 更多 >

    热门问题