2017-02-02 121 views
1

我正在使用Python 3.6。我已經通過命令ImportError:在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但我仍然得到導入錯誤從我的腳本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' 
+0

如何執行腳本? –

+0

我在[Thonny IDE]中運行腳本(http://thonny.org/) – Sithu

+2

您已經將軟件包安裝在用於運行腳本的其他解釋器中。 –

回答

1

我在Python初學者IDE Thonny中運行腳本。它使用不同的解釋器。當我在IDE的選項中設置正確的解釋器路徑時,導入錯誤消失了。

enter image description here

相關問題