python里面的import provide_Python importorror:没有名为wmi的模块
我按照說明在這里下載了用于Python的WMI
當我試圖運行代碼時import wmi
c = wmi.WMI ()
for s in c.Win32_Service (StartMode="Auto", State="Stopped"):
if raw_input ("Restart %s? " % s.Caption).upper () == "Y":
s.StartService ()
我收到錯誤Traceback (most recent call last):
File ".\see_wmi.py", line 1, in
import wmi
ImportError: No module named wmi
編輯:
我正在使用Python2.7.6
編輯2:
我運行64位Windows2008R2,我從https://pypi.python.org/pypi/WMI/下載了WMI-1.4.9.zip(md5)。我提取了內容并將其保存在D:\ Python\Tools\Scripts中。我執行了python setup.py.install
我將D:\ Python\Tools\Scripts添加到%PATH%,并且在執行代碼時import wmi
c = wmi.WMI ()
for s in c.Win32_Service (StartMode="Auto", State="Stopped"):
if raw_input ("Restart %s? " % s.Caption).upper () == "Y":
s.StartService ()
我明白錯誤Traceback (most recent call last):
File ".\see_wmi.py", line 1, in
import wmi
File "D:\Python\lib\site-packages\wmi.py", line 88, in
from win32com.client import GetObject, Dispatch
ImportError: No module named win32com.client
編輯3:
我現在有了Python2.7.6,安裝是D:\ Python27
我在D驅動器中提取了WMI-1.4.9.zip并執行了以下操作PS D:\WMI-1.4.9> python .\setup.py install
結果是running install
running build
running build_py
creating build
creating build\lib
copying wmi.py -> build\lib
running build_scripts
creating build\scripts-2.7
copying wmitest.py -> build\scripts-2.7
copying wmiweb.py -> build\scripts-2.7
copying wmitest.cmd -> build\scripts-2.7
copying wmitest.master.ini -> build\scripts-2.7
running install_lib
copying build\lib\wmi.py -> D:\Python27\Lib\site-packages
byte-compiling D:\Python27\Lib\site-packages\wmi.py to wmi.pyc
running install_scripts
creating D:\Python27\Scripts
copying build\scripts-2.7\wmitest.cmd -> D:\Python27\Scripts
copying build\scripts-2.7\wmitest.master.ini -> D:\Python27\Scripts
copying build\scripts-2.7\wmitest.py -> D:\Python27\Scripts
copying build\scripts-2.7\wmiweb.py -> D:\Python27\Scripts
running install_data
warning: install_data: setup script did not provide a directory for 'readme.txt' -- installing right in 'D:\Python27'
running install_egg_info
Writing D:\Python27\Lib\site-packages\WMI-1.4.9-py2.7.egg-info
但是當我執行我的原始代碼時,我會得到同樣的錯誤PS D:\SymantecDLP\Protect> python .\see_wmi.py
Traceback (most recent call last):
File ".\see_wmi.py", line 1, in
import wmi
File "D:\Python27\lib\site-packages\wmi.py", line 88, in
from win32com.client import GetObject, Dispatch
ImportError: No module named win32com.client
編輯4:
我在%PATH%中包含了以下內容D:\Python27;D:\Python27\Lib\;D:\Python27\Lib\site-packages
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的python里面的import provide_Python importorror:没有名为wmi的模块的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机网络构成ppt,计算机网络体系结构
- 下一篇: python sympy安装_SymPy