Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed
Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed
安装 pywinauto 后,我正在尝试 运行 那个简单的代码:
from pywinauto import Application
filename = 'notepad.exe'
app = aplication.Application().start(filename)
并得到错误:
Traceback (most recent call last):
File "D:\auto\retr\test.py", line 1, in <module>
from pywinauto import Application
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\__init__.py", line 89, in <module>
from . import findwindows
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "D:\Users2\AppData\Local\Programs\Python\Python39\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 "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\controls\uiawrapper.py", line 42, in <module>
from .. import backend
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\backend.py", line 35, in <module>
from .base_wrapper import BaseWrapper
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\base_wrapper.py", line 44, in <module>
import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.
如果我明确导入 win32ui:
import win32ui
from pywinauto import Application
错误变得更简单了,但仍然与以下问题无关:
Traceback (most recent call last):
File "D:\auto\retr\test.py", line 1, in <module>
import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.
我搜索了类似的问题,但没有找到任何解决方案..
我有Win10,python3.9
这似乎是
的副本
从那个和 the Github page 的外观来看,import win32ui
实际上在使用 pywin32 build 228 的 Python 3.9 上被破坏了。在另一个问题中发布了一个解决方法。简而言之,首选版本 229,在该版本之前,Github 页面有一个解决方法,即手动安装已打补丁的 228 版本的分支或 229 版本的手动版本。
为方便起见,.whls 可以找到 here。下载合适的文件并使用:
pip install -U --force-reinstall <FILE>.whl
问题很可能会得到解决。
安装 pywinauto 后,我正在尝试 运行 那个简单的代码:
from pywinauto import Application
filename = 'notepad.exe'
app = aplication.Application().start(filename)
并得到错误:
Traceback (most recent call last):
File "D:\auto\retr\test.py", line 1, in <module>
from pywinauto import Application
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\__init__.py", line 89, in <module>
from . import findwindows
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "D:\Users2\AppData\Local\Programs\Python\Python39\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 "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\controls\uiawrapper.py", line 42, in <module>
from .. import backend
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\backend.py", line 35, in <module>
from .base_wrapper import BaseWrapper
File "D:\Users2\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\base_wrapper.py", line 44, in <module>
import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.
如果我明确导入 win32ui:
import win32ui
from pywinauto import Application
错误变得更简单了,但仍然与以下问题无关:
Traceback (most recent call last):
File "D:\auto\retr\test.py", line 1, in <module>
import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.
我搜索了类似的问题,但没有找到任何解决方案..
我有Win10,python3.9
这似乎是
从那个和 the Github page 的外观来看,import win32ui
实际上在使用 pywin32 build 228 的 Python 3.9 上被破坏了。在另一个问题中发布了一个解决方法。简而言之,首选版本 229,在该版本之前,Github 页面有一个解决方法,即手动安装已打补丁的 228 版本的分支或 229 版本的手动版本。
为方便起见,.whls 可以找到 here。下载合适的文件并使用:
pip install -U --force-reinstall <FILE>.whl
问题很可能会得到解决。