我尝试将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
首次导入抛出&#34; TypeError:LoadLibrary()参数1必须是字符串,而不是unicode&#34; 错误,而如果我再次尝试导入它会抛出导入错误: &#34; ImportError:无法导入名称win32defines&#34; 如果有经验丰富的人可以帮助我,那将会很有帮助。
操作系统:赢10 python:2.7.13答案 0 :(得分:1)
当我安装2.7.13时,在另一个模块中有类似的问题。恢复到2.7.12(赢得7位64位时为32位)问题消失了。