我正在使用 Python 3.6。我已经通过命令安装了模块 comtypes
python -m pip install comtypes
Requirement already satisfied: comtypes in c:\users\singtech\appdata\local\programs\python\python36-32\lib\site-packages
但我的脚本中仍然出现 comtypes 的导入错误:
import comtypes.client as cc
import comtypes
mylib = cc.GetModule("d:\\path\\to\\mylib.dll")
print(mylib)
当我运行脚本时,它会产生以下错误:
Traceback (most recent call last):
File "D:\python-apps\aos.py", line 1, in <module>
import comtypes.client as cc
ImportError: No module named 'comtypes'
请您参考如下方法:
我在 Python 初学者 IDE 中运行脚本 Thonny .它使用不同的解释器。当我在 IDE 的选项中设置正确的解释器路径时,导入错误消失了。
