简体   繁体   English

使用python模块的Xlwings错误

[英]Xlwings error in using python modules

I'm attempting to use Xlwings for Python, however having installed Python 3.5, pywin32 extensions and Xlwings I get the following error when starting import: 我正在尝试将Xlwings用于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

Try commenting out the asserts (replace them with a pass ) and see if it works. 尝试注释掉断言(用 pass代替它们),看看它是否有效。 Otherwise you're going to need to debug pywintypes. 否则,您将需要调试pywintypes。

Felix Zumstein just informed me that the above suggestion won't work: Felix Zumstein刚刚告诉我 ,以上建议无效:

When you comment out those lines, then it fails further down when doing from pywintypes import TimeType: ImportError: cannot import name 'TimeType' 当您注释掉这些from pywintypes import TimeType: ImportError: cannot import name 'TimeType' ,然后from pywintypes import TimeType: ImportError: cannot import name 'TimeType'执行操作时,它将进一步失败, from pywintypes import TimeType: ImportError: cannot import name 'TimeType'

However, downgrading may solve this problem. 但是, 降级可以解决此问题。

After Much trial and error ive found that downgrading to Python 3.3 works 经过多次试验和错误ive发现,降级到Python 3.3是可行的

Thnak you for all the responses 谢谢您的所有回应

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM