python-3.x - 导入错误 : No module named keyboard

标签 python-3.x macos

关闭。这个问题需要debugging details .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

去年关闭。




Improve this question




不工作

import pygame,sys,random,time,keyboard
错误
Traceback (most recent call last):
ImportError: No module named keyboard
[dir: /Users/sebastianegeland/Desktop/kode stuff]
[path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyt

最佳答案

看起来您根本没有安装“键盘”库。
在您的终端中只需执行

pip install keyboard

它应该工作。

为清楚起见,我也会每行进行一次导入,如下所示:
import pygame
import sys
import etc

这是导入多个模块的首选方式。

关于python-3.x - 导入错误 : No module named keyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57761896/

相关文章:

python - SQLAlchemy 中的一对多关系

python - 将数组列表转换为 Pandas 数据框

c++ - 如何在 Mac 上调试 C++ 运行时错误?

macos - Mac上的Docker Compose-镜像位置

iphone - 如何找到NSString使用的内存?

macos - 无法从 PHP : "mysql_connect(): No such file or directory" 连接到 MySQL

python - 字典更新序列元素错误

python - Python (3.3) 包如何工作?

python - 我如何使用 16 :9 aspect ratio. python 3 计算出最接近的分辨率

macos - 如何在 zshell 中使用 `M-x` 中的 `emacs -nw`