ImportError:没有名为 win32api、python 的模块,即使 win32api 的位置附加到路径中也是如此
我对 python 还很陌生。 (Python 2.6)
我试图通过导入 wmi 模块来列出正在运行的进程。
import wmi
sys.path.append(r'C:\Python26\Lib\site-packages\isapi\test\build\bdis.win32\winexe\temp')
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
系统搜索表明在上述代码的append 语句中的位置找到了win32api。但我仍然收到错误: ImportError:没有名为 win32api 的模块
实际错误:
Traceback (most recent call last):
File "C:\Documents and Settings\xxxx\Desktop\Python\Practice Code\file.py", line 1, in <module>
import wmi
File "C:\Python26\lib\site-packages\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
File "C:\Python26\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: No module named win32api
我已经安装了 win32extensions 确保版本和平台匹配。我用的是2.6 我还安装了 wmi-1.4.6
我的路径:
C:\Documents and Settings\xxxx\Desktop\Python\Practice Code
C:\Python26\Lib\idlelib
C:\WINDOWS\system32\python26.zip
C:\Python26\DLLs
C:\Python26\lib
C:\Python26\lib\plat-win
C:\Python26\lib\lib-tk
C:\Python26
C:\Python26\lib\site-packages
有什么想法吗?
I'm fairly new to python. (Python 2.6)
I'm trying to list the running processes by importing the wmi module.
import wmi
sys.path.append(r'C:\Python26\Lib\site-packages\isapi\test\build\bdis.win32\winexe\temp')
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
A system search pointed to win32api being found at the location in the append statement in the code above. But I still get the error: ImportError: No module named win32api
The actual error:
Traceback (most recent call last):
File "C:\Documents and Settings\xxxx\Desktop\Python\Practice Code\file.py", line 1, in <module>
import wmi
File "C:\Python26\lib\site-packages\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
File "C:\Python26\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: No module named win32api
I've installed win32extensions making sure the versions and platform match. I'm using 2.6
I've also installed wmi-1.4.6
My path:
C:\Documents and Settings\xxxx\Desktop\Python\Practice Code
C:\Python26\Lib\idlelib
C:\WINDOWS\system32\python26.zip
C:\Python26\DLLs
C:\Python26\lib
C:\Python26\lib\plat-win
C:\Python26\lib\lib-tk
C:\Python26
C:\Python26\lib\site-packages
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该包含您需要的所有信息:
http://mail. python.org/pipermail/python-win32/2003-December/001482.html
不需要WMI,只需使用Win32扩展。
彼得
This should have all the information you need:
http://mail.python.org/pipermail/python-win32/2003-December/001482.html
No need to for WMI, just use Win32 Extensions.
Peter