python里面的import provide_Python importorror:没有名为wmi的模块
我按照說明在這里下載了用于Python的WMI
當(dāng)我試圖運(yùn)行代碼時(shí)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 ()
我收到錯(cuò)誤Traceback (most recent call last):
File ".\see_wmi.py", line 1, in
import wmi
ImportError: No module named wmi
編輯:
我正在使用Python2.7.6
編輯2:
我運(yùn)行64位Windows2008R2,我從https://pypi.python.org/pypi/WMI/下載了WMI-1.4.9.zip(md5)。我提取了內(nèi)容并將其保存在D:\ Python\Tools\Scripts中。我執(zhí)行了python setup.py.install
我將D:\ Python\Tools\Scripts添加到%PATH%,并且在執(zhí)行代碼時(shí)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 ()
我明白錯(cuò)誤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:
我現(xiàn)在有了Python2.7.6,安裝是D:\ Python27
我在D驅(qū)動(dòng)器中提取了WMI-1.4.9.zip并執(zhí)行了以下操作PS D:\WMI-1.4.9> python .\setup.py install
結(jié)果是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
但是當(dāng)我執(zhí)行我的原始代碼時(shí),我會(huì)得到同樣的錯(cuò)誤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%中包含了以下內(nèi)容D:\Python27;D:\Python27\Lib\;D:\Python27\Lib\site-packages
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的python里面的import provide_Python importorror:没有名为wmi的模块的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机网络构成ppt,计算机网络体系结构
- 下一篇: websocket python爬虫_p