[英]No module named win32com.client
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".当我尝试执行以下代码时,我的系统安装了 Win 7 64 位,我遇到了错误“没有名为 win32com.client 的模块”。 Can anyone help me with that?
任何人都可以帮助我吗?
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 的模块
UPDATE 2016 2016 年更新
There is now a version of pywin32 on PyPI that can be installed with pip.现在 PyPI 上有一个 pywin32 版本,可以用 pip 安装。 It is called pypiwin32, and it installs the package using the binary wheel format.
它被称为 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 等。
You can google it.你可以谷歌一下。 Visit this link and choose the right version to install on your computer。
访问此链接并选择正确的版本安装到您的计算机上。
As of 2020, Python 2 is unsupported.截至 2020 年, Python 2 不受支持。
Also, the package named pypiwin32
looks abandoned as it lags behind in version (221 vs 224 ) and lacks a description.此外,名为
pypiwin32
的包看起来被遗弃了,因为它落后于版本(221 vs 224 )并且缺乏描述。
python -m pip install pywin32
works in Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 on Windows 10, and Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32 on Windows 10 Pro, but if it doesn't for you: python -m pip install pywin32
适用于 Python 3.7.0(v3.7.0:1bf9cc5093,2018 年 6 月 27 日,04:06:47)[MSC v.1914 32 位(英特尔)] on win32 on Windows 10 和 Python 3.8。 6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 位 (AMD64)] on win32 on Windows 10 Pro,但如果它不适合你:
Install the pywin32 package :安装 pywin32 包:
python -m pip install pywin32
python C:\\Users\\Cees\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\Scripts\\pywin32_postinstall.py -install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.