导入ctypes.wintypes时出错

时间:2014-01-03 06:23:40

标签: python linux ctypes

当我尝试导入ctypes.wintypes时出现此错误,我该如何解决此问题?

In [2]: import ctypes.wintypes
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-8395760a4e8a> in <module>()
----> 1 import ctypes.wintypes

/usr/lib/python2.7/ctypes/wintypes.py in <module>()
     21 
     22 from ctypes import _SimpleCData
---> 23 class VARIANT_BOOL(_SimpleCData):
     24     _type_ = "v"
     25     def __repr__(self):

ValueError: _type_ 'v' not supported

1 个答案:

答案 0 :(得分:6)

您只能在Windows中导入ctypes.wintypes。 (ctypes.wintypes包含特定于窗口的数据类型。)

视窗:

>>> import ctypes.wintypes
>>>

Linux的:

>>> import ctypes.wintypes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
    class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported
>>>
相关问题