我下载了压缩文件形式的comtypes,并使用pip install comtypes-1.1.7.zip进行了安装。已成功安装,但当我尝试导入模块时,它显示错误消息:
>>> import comtypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python367\lib\comtypes\__init__.py", line 381
except COMError, err:
^
SyntaxError: invalid syntax发布于 2019-03-27 00:37:10
语法只对Python 2有效。很明显,Python 3的代码没有完全更新。请在他们的跟踪器上报告错误。
发布于 2019-08-09 00:28:52
博士的答案是正确的。我使用anaconda distrib成功修复了这个错误。只需用anaconda目录的内容替换目录Lib\site-package\comtypes的内容即可。
https://stackoverflow.com/questions/55361329
复制相似问题