python 2.7 的 pywinauto 导入错误

pywinauto import error for python 2.7

我尝试将 pywinauto 用于 python 2.7。使用 pip 安装按预期进行。但是当我尝试在 python 中导入 pywinauto 包时,出现以下错误:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "pywinauto\findwindows.py", line 39, in <module>
from . import win32functions
File "pywinauto\win32functions.py", line 216, in <module>
shcore = ctypes.windll.LoadLibrary(u"Shcore.dll")
File "D:\Program Files\python-2.7\lib\ctypes\__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "D:\Program Files\python-2.7\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not unicode


>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "pywinauto\findwindows.py", line 39, in <module>
from . import win32functions
File "pywinauto\win32functions.py", line 35, in <module>
from . import win32defines, win32structures
ImportError: cannot import name win32defines

第一次导入会抛出 "TypeError: LoadLibrary() argument 1 must be string, not unicode" 错误,而如果我再次尝试导入它会抛出导入错误:"ImportError: cannot import name win32defines".
如果有更多经验的人可以帮助我,那将很有帮助。

OS: 赢 10
python: 2.7.13
pywinauto: 0.6

我在安装 2.7.13 时在另一个模块中遇到了类似的问题。恢复到 2.7.12(win 7 64 位上的 32 位),问题消失了。