Ich bin ein Anfänger in Python. Wenn ich den folgenden Python-Beispielcode mit Typ-Bibliothek auf Mac OS X Lion versucht:Mac OS X Lion Python C Typ CDLL Fehler lib.so.6: Bild nicht gefunden
#hello.py
from ctypes import *
cdll.LoadLibrary("libc.so.6")
libc = CDLL("libc.so.6")
message_string = "Hello World! Hello Python!\n"
libc.printf("Testing :%s",message_string)
//
ist ein Fehler aufgetreten, wie folgend:
Traceback (most recent call last):
File "cprintf.py", line 2, in <module>
cdll.LoadLibrary("libc.so.6")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(libc.so.6, 6): image not found
Kann mir jemand sagen, was ist los? BTW, ich habe das unter Windows und Linux versucht; es hat gut funktioniert. Muss ich einige Konfiguration für ctype vornehmen.
Vielen Dank,
Ricky
Danke Kevin, es funktioniert jetzt. – Gickian