我已经正确安装了 gphoto,我可以使用我的相机的所有功能,但出于某种原因
gphoto = ctypes.CDLL('libgphoto2.dylib')
引发错误。
$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> gphoto = ctypes.CDLL('libgphoto2.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 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libgphoto2.dylib, 6): image not found
>>>
我使用 macports 安装了 libgphoto2,就像我说的 gphoto 工作正常:
$ gphoto2 --capture-image-and-download
New file is in location /capt0000.nef on the camera
Saving file as capt0000.nef
Deleting file /capt0000.nef on the camera
Deleting 'capt0000.nef' from folder '/'...
所以我不明白为什么 gphoto2 可以使用 libgphoto2 而 ctypes 不能。有什么建议么?我对此很陌生,所以这可能是一个非常基本的愚蠢错误。