为python错误导入键盘 [英] import keyboard for python error

查看:58
本文介绍了为python错误导入键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用

pip 安装键盘.

安装后我尝试导入它

import keyboard as keyboard

但是它给了我这个错误:

however it gives me this error:

File "C:\Python27\lib\site-packages\keyboard\__init__.py", line 120, in <module>
    from. import _winkeyboard as _os_keyboard
  File "C:\Python27\lib\site-packages\keyboard\_winkeyboard.py", line 37, in <module>
    kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
  File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not unicode

我唯一的猜测是我没有这些文件之一,或者我需要另一个键盘依赖项.任何帮助将不胜感激

my only guess is that i dont have one of these files or i need another dependancy for keyboard. Any help would be much appreciated

推荐答案

这是 Python 中的一个错误,由 https://bugs.python.org/issue27330 并在 https 中修复://bugs.python.org/issue29082.它存在于2.7.13已在 2.7.14 中修复.

This is a bug in Python that was caused in the 2.7 release line by https://bugs.python.org/issue27330 and fixed in https://bugs.python.org/issue29082 . It exists in 2.7.13 and is fixed in 2.7.14.

keyboard 触发此错误 通过在 keyboard._winkeyboard 中使用 from __future__ import unicode_literals.

这篇关于为python错误导入键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆