我正在尝试使用Xlwings for Python,但是已经安装了Python 3.5,pywin32扩展和Xlwings,我在开始导入时遇到以下错误:
from xlwings import workbook
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from xlwings import workbook
File "C:\Python 3.5\lib\site-packages\xlwings\__init__.py", line 18, in <module>
from . import _xlwindows as xlplatform
File "C:\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
import pywintypes
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
答案 0 :(得分:1)
尝试注释掉断言(用 pass
替换它们)并查看它是否有效。否则你将需要调试pywintypes。
Felix Zumstein just informed me上述建议无法发挥作用:
当您注释掉这些行时,在执行
时它会进一步失败from pywintypes import TimeType: ImportError: cannot import name 'TimeType'
答案 1 :(得分:0)
经过多次试验和错误后,我发现降级到Python 3.3工作
向你致谢所有回复