Reputation: 4727
On Macos, I have set DYLD_LIBRARY_PATH
this way:
export DYLD_LIBRARY_PATH=/Applications/PicoScope6.app/Contents/Resources/lib
If I run those two lines in IPython, it works :
from ctypes import cdll
cdll.LoadLibrary("libps2000a.dylib")
but I run them in the standard python interpreter, I get :
$ /usr/bin/python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import cdll
>>> cdll.LoadLibrary("libps2000a.dylib")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libps2000a.dylib, 6): image not found
EDIT1 : I think it has something to with the Python provided by Apple because with /usr/local/bin/python2
(provided by the brew
utility), it works :
$ /usr/local/bin/python2
Python 2.7.13 (default, Jul 18 2017, 09:17:00)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import cdll
>>> cdll.LoadLibrary("libps2000a.dylib")
<CDLL 'libps2000a.dylib', handle 7f8838d01f80 at 10b438f50>
EDIT2 : I have the same pb. with the DYLD_LIBRARY_PATH
variable as with the LD_LIBRARY_PATH
variable
What can I do to "tell" the "Apple Python" to "see" the DYLD_LIBRARY_PATH
?
Upvotes: 0
Views: 1561
Reputation: 58543
On MacOS X it is DYLD_LIBRARY_PATH
not LD_LIBRARY_PATH
.
See the man page for dyld
for details on environment variables you can set which affect the dynamic linker.
Upvotes: 1