gpt4 book ai didi

python - 我已经安装了包 :pywinauto successfully with "pip install pywinauto", 但它总是失败,为什么?

转载 作者:可可西里 更新时间:2023-11-01 11:16:18 26 4
gpt4 key购买 nike

全部,

我已经使用“pip install pywinauto”成功安装了 package:pywinauto,但总是失败,为什么?我是这样做的:

pip 安装 pywinauto

然后在 windows cmd env 下运行 python:接着:导入pywinauto我收到以下错误:....

>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "C:\Python27\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "C:\Python27\lib\site-packages\pywinauto\controls\__init__.py", line 36,in <module>
from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
File "C:\Python27\lib\site-packages\pywinauto\controls\uiawrapper.py", line 44, in <module>
from ..uia_defines import IUIA
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 175, in <module>
pattern_ids = _build_pattern_ids_dic()
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 163, in _build_pattern_ids_dic
if hasattr(IUIA().ui_automation_client, cls_name):
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 50, in __call__
cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 60, in __init__
self.UIA_dll = comtypes.client.GetModule('UIAutomationCore.dll')
File "C:\Python27\lib\site-packages\comtypes\client\_generate.py", line 97, in GetModule
tlib = comtypes.typeinfo.LoadTypeLibEx(tlib)
File "C:\Python27\lib\site-packages\comtypes\typeinfo.py", line 485, in LoadTypeLibEx
_oleaut32.LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
File "_ctypes/callproc.c", line 950, in GetResult
WindowsError: [Error -2147312566] Error loading type library/DLL

最佳答案

看起来您使用的是旧操作系统 Windows 版本,例如 Windows XP。 MS UI Automation 包含在 Windows Vista 及更高版本中。但是您可以安装 .NET Framework 3.0+ 以获得 UIAutomationCore.dll,甚至在 Windows XP 上也可用。如果您根本不需要 MS UI 自动化技术,只需运行 pip uninstall comtypes,pywinauto 将仅适用于 Win32 API。

关于python - 我已经安装了包 :pywinauto successfully with "pip install pywinauto", 但它总是失败,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42243698/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com