Python 没有名为 win32com.client 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33471804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 13:24:58  来源:igfitidea点击:

No module named win32com.client

python

提问by Madhu

My System has Win 7 64bit installed when I try to execute the below code I'm facing with the error "No module named win32com.client". Can anyone help me with that?

当我尝试执行以下代码时,我的系统安装了 Win 7 64 位,我遇到了错误“没有名为 win32com.client 的模块”。任何人都可以帮助我吗?

import wmi
c = wmi.WMI()
display = c.Win32_videocontroller
print display.properties

I'm using Python 2.7Ver

我正在使用 Python 2.7Ver

Error code:

错误代码:

Traceback (most recent call last): File "", line 1, in import wmi File "C:\Python27\lib\site-packages\wmi.py", line 88, in from win32com.client import GetObject, Dispatch

回溯(最近一次调用最后一次):文件“”,第 1 行,在 import wmi 文件“C:\Python27\lib\site-packages\wmi.py”,第 88 行,在 from win32com.client import GetObject, Dispatch

ImportError: No module named win32com.client

导入错误:没有名为 win32com.client 的模块

回答by veekxt

You can google it.Visit this linkand choose the right version to install on your computer。

你可以谷歌一下。访问此链接并选择正确的版本安装到您​​的计算机上。

回答by AB Abhi

Go To this link

转到此链接

Then use

然后使用

$python setup.py install

回答by M.S. Arun

UPDATE 2016

2016 年更新

There is now a version of pywin32 on PyPI that can be installed with pip. It is called pypiwin32, and it installs the package using the binary wheel format.

现在 PyPI 上有一个 pywin32 版本,可以用 pip 安装。它被称为 pypiwin32,它使用二进制轮格式安装包。

https://pypi.python.org/pypi/pypiwin32

https://pypi.python.org/pypi/pypiwin32

    pip install pypiwin32

That will work in a virtualenv, or with tox, etc.

这将适用于 virtualenv 或 tox 等。

回答by Cees Timmerman

python -m pip install pywin32

Works fine on Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32.

在 Win32 上的 Python 3.7.0(v3.7.0:1bf9cc5093,2018 年 6 月 27 日,04:06:47)[MSC v.1914 32 位(英特尔)] 上运行良好。

The package named pypiwin32looks abandoned as it lags behind in version (221 vs 224) and lacks a description.

名为的包pypiwin32看起来被遗弃了,因为它落后于版本 (221 vs 224) 并且缺少描述。