Tôi là người mới bắt đầu bằng Python. Khi tôi thử như sau Python mẫu mã với kiểu thư viện trên Mac OS X Lion:Mac OS X Lion Python Ctype Lỗi CDLL.so.6: không tìm thấy hình ảnh
#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)
//
Một lỗi xảy ra như sau:
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
bất cứ ai có thể cho tôi biết có chuyện gì vậy? BTW, tôi đã thử trên Windows và Linux; nó hoạt động tốt. Tôi cần thực hiện một số cấu hình cho ctype.
Cảm ơn rất nhiều,
Ricky
Cảm ơn Kevin, nó hoạt động ngay bây giờ. – Gickian