Sur Mac OS, j'ai mis DYLD_LIBRARY_PATH
cette façon:"Apple Python": OSError: dlopen (libps2000a.dylib, 6): l'image non trouvée mais pas dans IPython
export DYLD_LIBRARY_PATH=/Applications/PicoScope6.app/Contents/Resources/lib
Si je cours ces deux lignes IPython, cela fonctionne:
from ctypes import cdll
cdll.LoadLibrary("libps2000a.dylib")
mais je les exécuter dans l'interpréteur python standard, je reçois:
$ /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: Je THI nk il a quelque chose à avec le Python fourni par Apple, car avec /usr/local/bin/python2
(fourni par l'utilitaire brew
), il fonctionne:
$ /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: J'ai le même pb. avec la variable DYLD_LIBRARY_PATH
comme avec la variable LD_LIBRARY_PATH
Que puis-je faire pour "dire" le "Apple Python" à "voir" le DYLD_LIBRARY_PATH
?
J'ai le même pb. avec la variable 'DYLD_LIBRARY_PATH' – SebMa
Pouvez-vous s'il vous plaît lire mon' EDIT2'? – SebMa
Avez-vous vérifié qu'il est correctement défini dans le processus après qu'il a commencé en utilisant '' import os; os.environ ['DYLD_LIBRARY_PATH'] ''? –