通过 pip 从 zip 文件安装 comtypes-1.1.7 后出错

Error after installing comtypes-1.1.7 via pip from zip file

我下载了 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

语法仅对 Python 有效 2. 代码显然没有完全更新 Python 3. 在他们的跟踪器上报告错误。

phd 的回答是正确的。我使用 anaconda distrib 成功修复了这个错误。 只需将目录 Lib\site-packages\comtypes 的内容替换为 anaconda 目录的内容即可。