gpt4 book ai didi

python - 为什么导入 ctypes 会引发 ImportError?

转载 作者:太空狗 更新时间:2023-10-30 02:06:43 26 4
gpt4 key购买 nike

Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 17, in <module>
from struct import calcsize as _calcsize
ImportError: cannot import name calcsize

>>> from ctypes import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\ctypes\__init__.py", line 17, in <module>
from struct import calcsize as _calcsize
ImportError: cannot import name calcsize
>>>

最佳答案

看来您的路径中某处还有另一个 struct.py。

试试看 python 在哪里找到你的结构模块:

>>> import inspect
>>> import struct
>>> inspect.getabsfile(struct)
'c:\\python26\\lib\\struct.py'

关于python - 为什么导入 ctypes 会引发 ImportError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1270738/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com