树莓派脑壳疼问题解决:终端pip3 list中查看库是存在的,但是运行却报错ModuleNotFoundError: No module named ‘keyboard‘

一、问题描述

百度了一堆,对这个库又是重装又是升级,尝试了很多办法,但是依然报错:

pi@raspberrypi:~/it $ sudo python3 /home/pi/it/music.py
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/home/pi/it/music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'

最终在实验室大佬的帮助下搞定了。现在记录下解决的方法,仅供参考,每个人报错出现问题的原因都不同。

二、解决方法

通过命令进入root

pi@raspberrypi:~/it $ sudo -i

随后查看一下安装的库有没有(我的用pip3安装后在root下竟然没有,但是在常规下是有的,很神奇,姑且叫做玄学问题,如果有大佬知道为什么,可以告知我一下):

root@raspberrypi:/home/pi/it# pip3 list
Package           Version    
----------------- -----------
appdirs           1.4.3       
Cap1xxx           0.1.3      
certifi           2018.8.24  
chardet           3.0.4      
Click             7.0        
colorama          0.3.7      
colorzero         1.1   
xxxxxxxxxxand so on########     

树莓派脑壳疼问题解决:终端pip3 list中查看库是存在的,但是运行却报错ModuleNotFoundError: No module named ‘keyboard‘_第1张图片

 在root权限下安装库:

root@raspberrypi:/home/pi/it# pip3 install keyboard
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting keyboard
  Downloading https://files.pythonhosted.org/packages/55/88/287159903c5b3fc6d47b651c7ab65a54dcf9c9916de546188a7f62870d6d/keyboard-0.13.5-py3-none-any.whl (58kB)
    100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 61kB 617kB/s 
Installing collected packages: keyboard
Successfully installed keyboard-0.13.5

安装完成后再用pip3 list查看一下,保证确实安装上了。

然后用cd命令移步到文件目录下,便可运行。

用同样的方法处理了一下cv库,得到解决。

三、全过程实录

pi@raspberrypi:~ $ cd /home/pi/it
pi@raspberrypi:~/it $ sudo -i  python3 /home/pi/it/music.py

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/home/pi/it/music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ pip3 uninstall keyboard
Uninstalling keyboard-0.13.5:
  Would remove:
    /home/pi/.local/lib/python3.7/site-packages/keyboard-0.13.5.dist-info/*
    /home/pi/.local/lib/python3.7/site-packages/keyboard/*
Proceed (y/n)? Y
  Successfully uninstalled keyboard-0.13.5
pi@raspberrypi:~/it $ pip uninstall keyboard
Uninstalling keyboard-0.13.5:
  Would remove:
    /home/pi/.local/lib/python2.7/site-packages/keyboard-0.13.5.dist-info/*
    /home/pi/.local/lib/python2.7/site-packages/keyboard/*
Proceed (y/n)? Y
  Successfully uninstalled keyboard-0.13.5
pi@raspberrypi:~/it $ pip3 install keyboard
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting keyboard
  Using cached https://files.pythonhosted.org/packages/55/88/287159903c5b3fc6d47b651c7ab65a54dcf9c9916de546188a7f62870d6d/keyboard-0.13.5-py3-none-any.whl
Installing collected packages: keyboard
Successfully installed keyboard-0.13.5
pi@raspberrypi:~/it $ cd /home/pi/it
pi@raspberrypi:~/it $ sudo -i  python3 /home/pi/it/music.py

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/home/pi/it/music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ sudo python3 /home/pi/it/music.py
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/home/pi/it/music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ pip list
Package           Version    
----------------- -----------
arandr            0.1.9      
asn1crypto        0.24.0     
automationhat     0.2.0      
blinker           1.4        
blinkt            0.1.2      
buttonshim        0.0.2      
Cap1xxx           0.1.3      
certifi           2018.8.24  
chardet           3.0.4      
Click             7.0        
colorama          0.3.7      
colorzero         1.1        
configparser      3.5.0b2    
cookies           2.2.1      
cryptography      2.6.1      
decorator         4.4.2      
drumhat           0.1.0      
entrypoints       0.3        
enum34            1.1.6      
envirophat        1.0.0      
ExplorerHAT       0.4.2      
Flask             1.0.2      
fourletterphat    0.1.0      
funcsigs          1.0.2      
futures           3.3.0      
gpiozero          1.5.1      
gyp               0.1        
idna              2.6        
imageio           2.4.1      
ipaddress         1.0.17     
itsdangerous      0.24       
Jinja2            2.10       
keyring           17.1.1     
keyrings.alt      3.1.1      
MarkupSafe        1.1.0      
mcpi              0.1.1      
microdotphat      0.2.1      
mock              2.0.0      
mote              0.0.4      
motephat          0.0.3      
moviepy           1.0.3      
numpy             1.16.2     
oauthlib          2.1.0      
olefile           0.46       
pantilthat        0.0.7      
pbr               4.2.0      
phatbeat          0.1.1      
pianohat          0.1.0      
picamera          1.13       
picraft           1.0        
piglow            1.2.5      
pigpio            1.78       
Pillow            5.4.1      
pip               18.1       
proglog           0.1.9      
pycairo           1.16.2     
pycrypto          2.6.1      
pyflakes          2.0.0      
pygame            1.9.4.post1
PyGObject         3.30.4     
pyinotify         0.9.6      
PyJWT             1.7.0      
pyOpenSSL         19.0.0     
pyserial          3.4        
pyxdg             0.25       
rainbowhat        0.1.0      
requests          2.21.0     
requests-oauthlib 1.0.0      
responses         0.9.0      
RPi.GPIO          0.7.0      
RTIMULib          7.2.1      
scrollphat        0.0.7      
scrollphathd      1.2.1      
SecretStorage     2.3.1      
sense-emu         1.1        
sense-hat         2.2.0      
setuptools        40.8.0     
simplejson        3.16.0     
six               1.12.0     
skywriter         0.0.7      
sn3218            1.2.7      
spidev            3.4        
touchphat         0.0.1      
tqdm              4.62.0     
twython           3.7.0      
unicornhathd      0.0.4      
urllib3           1.24.1     
Werkzeug          0.14.1     
wheel             0.32.3     
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ pip3 list
Package           Version    
----------------- -----------
appdirs           1.4.3      
asn1crypto        0.24.0     
astroid           2.1.0      
asttokens         1.1.13     
automationhat     0.2.0      
beautifulsoup4    4.7.1      
blinker           1.4        
blinkt            0.1.2      
buttonshim        0.0.2      
Cap1xxx           0.1.3      
certifi           2018.8.24  
chardet           3.0.4      
Click             7.0        
colorama          0.3.7      
colorzero         1.1        
cookies           2.2.1      
cryptography      2.6.1      
cupshelpers       1.0        
cycler            0.10.0     
decorator         4.3.0      
docutils          0.14       
drumhat           0.1.0      
entrypoints       0.3        
envirophat        1.0.0      
ExplorerHAT       0.4.2      
Flask             1.0.2      
fourletterphat    0.1.0      
gpiozero          1.5.1      
guizero           0.6.0      
html5lib          1.0.1      
idna              2.6        
ipykernel         4.9.0      
ipython           5.8.0      
ipython-genutils  0.2.0      
isort             4.3.4      
itsdangerous      0.24       
jedi              0.13.2     
Jinja2            2.10       
jupyter-client    5.2.3      
jupyter-core      4.4.0      
keyboard          0.13.5     
keyring           17.1.1     
keyrings.alt      3.1.1      
kiwisolver        1.0.1      
lazy-object-proxy 1.3.1      
logilab-common    1.4.2      
lxml              4.3.2      
MarkupSafe        1.1.0      
matplotlib        3.0.2      
mccabe            0.6.1      
microdotphat      0.2.1      
mote              0.0.4      
motephat          0.0.3      
mypy              0.670      
mypy-extensions   0.4.1      
nudatus           0.0.4      
numpy             1.16.2     
oauthlib          2.1.0      
olefile           0.46       
opencv-python     4.5.3.56   
pantilthat        0.0.7      
parso             0.3.1      
pexpect           4.6.0      
pgzero            1.2        
phatbeat          0.1.1      
pianohat          0.1.0      
picamera          1.13       
pickleshare       0.7.5      
picraft           1.0        
piglow            1.2.5      
pigpio            1.78       
Pillow            5.4.1      
pip               18.1       
prompt-toolkit    1.0.15     
psutil            5.5.1      
pycairo           1.16.2     
pycodestyle       2.4.0      
pycrypto          2.6.1      
pycups            1.9.73     
pyflakes          2.0.0      
pygame            1.9.4.post1
Pygments          2.3.1      
PyGObject         3.30.4     
pyinotify         0.9.6      
PyJWT             1.7.0      
pylint            2.2.2      
pyOpenSSL         19.0.0     
pyparsing         2.2.0      
pyserial          3.4        
pysmbc            1.0.15.6   
python-apt        1.8.4.3    
python-dateutil   2.7.3      
pyxdg             0.25       
pyzmq             17.1.2     
qtconsole         4.3.1      
rainbowhat        0.1.0      
reportlab         3.5.13     
requests          2.21.0     
requests-oauthlib 1.0.0      
responses         0.9.0      
roman             2.0.0      
RPi.GPIO          0.7.0      
RTIMULib          7.2.1      
scrollphat        0.0.7      
scrollphathd      1.2.1      
SecretStorage     2.3.1      
semver            2.0.1      
Send2Trash        1.5.0      
sense-emu         1.1        
sense-hat         2.2.0      
setuptools        40.8.0     
simplegeneric     0.8.1      
simplejson        3.16.0     
six               1.12.0     
skywriter         0.0.7      
sn3218            1.2.7      
soupsieve         1.8        
spidev            3.4        
ssh-import-id     5.7        
thonny            3.3.6      
tornado           5.1.1      
touchphat         0.0.1      
traitlets         4.3.2      
twython           3.7.0      
typed-ast         1.3.1      
uflash            1.2.4      
unicornhathd      0.0.4      
urllib3           1.24.1     
wcwidth           0.1.7      
webencodings      0.5.1      
Werkzeug          0.14.1     
wheel             0.32.3     
wrapt             1.10.11    
pi@raspberrypi:~/it $ cd
pi@raspberrypi:~ $ ls
Bookshelf  Desktop  Documents  Downloads  it  mu_code  Music  Pictures  Public  Templates  Videos
pi@raspberrypi:~ $ cd it
pi@raspberrypi:~/it $ ls
1Hz.mp4               combine.py                            GrasslandScenery_brightness_X0.7.mp4         GrasslandScenery_brightness_X1.0_Light3.mp4  GrasslandScenery_brightness_X1.3.mp4  MovieWithoutAudio.py
200Hz.mp4             GrasslandScenery_brightness_X0.1.mp4  GrasslandScenery_brightness_X1.0_Light1.mp4  GrasslandScenery_brightness_X1.0_Light4.mp4  GrasslandScenery_brightness_X1.6.mp4  MUSIC
brightness_adjust.py  GrasslandScenery_brightness_X0.4.mp4  GrasslandScenery_brightness_X1.0_Light2.mp4  GrasslandScenery_brightness_X1.0.mp4         GrasslandScenery_brightness_X1.9.mp4  music.py
pi@raspberrypi:~/it $ python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
#########\u529f\u80fd\u83dc\u5355#########
# 0.\u64ad\u653e                 #
# 1.\u6682\u505c                 #
# 2.\u7ee7\u7eed                 #
# 3.\u5207\u6b4c                 #
# 4.\u505c\u6b62                 #
##########################
Traceback (most recent call last):
  File "music.py", line 93, in 
    if keyboard.is_pressed('0'):
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 410, in is_pressed
    _listener.start_if_necessary()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
    self.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 196, in init
    _os_keyboard.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 113, in init
    build_device()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
pi@raspberrypi:~/it $ sudo python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ sudo python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
#########\u529f\u80fd\u83dc\u5355#########
# 0.\u64ad\u653e                 #
# 1.\u6682\u505c                 #
# 2.\u7ee7\u7eed                 #
# 3.\u5207\u6b4c                 #
# 4.\u505c\u6b62                 #
##########################
Traceback (most recent call last):
  File "music.py", line 93, in 
    if keyboard.is_pressed('0'):
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 410, in is_pressed
    _listener.start_if_necessary()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
    self.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 196, in init
    _os_keyboard.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 113, in init
    build_device()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
pi@raspberrypi:~/it $ sudo python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "music.py", line 7, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyboard
>>> import keyboard
>>> import keyboard
>>> 
KeyboardInterrupt
>>> 
pi@raspberrypi:~/it $ python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
pi@raspberrypi:~/it $ python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
pi@raspberrypi:~/it $ python3 test.py 
  File "test.py", line 21
    music_name = music
             ^
IndentationError: expected an indented block
pi@raspberrypi:~/it $ python3 test.py 
  File "test.py", line 21
    music_name = music
             ^
IndentationError: expected an indented block
pi@raspberrypi:~/it $ python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
pi@raspberrypi:~/it $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ketboard
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'ketboard'
>>> import keyboard
>>> keyboard.is_pressed('0')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 410, in is_pressed
    _listener.start_if_necessary()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
    self.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 196, in init
    _os_keyboard.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 113, in init
    build_device()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
>>> 
>>> 
>>> 
>>> 
>>> keyboard.is_pressed('0')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 410, in is_pressed
    _listener.start_if_necessary()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
    self.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 196, in init
    _os_keyboard.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 113, in init
    build_device()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
>>> keyboard.is_pressed('0')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 410, in is_pressed
    _listener.start_if_necessary()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
    self.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/__init__.py", line 196, in init
    _os_keyboard.init()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 113, in init
    build_device()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
    ensure_root()
  File "/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
>>> 
KeyboardInterrupt
>>> 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ sudo python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "test.py", line 6, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
pi@raspberrypi:~/it $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ 
pi@raspberrypi:~/it $ sudo python test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "test.py", line 6, in 
    import keyboard
ImportError: No module named keyboard
pi@raspberrypi:~/it $ sudo -i

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

root@raspberrypi:~# cd it
-bash: cd: it: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55
root@raspberrypi:~# cd it
-bash: cd: it: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55
root@raspberrypi:~# cd /home/pi/it/
root@raspberrypi:/home/pi/it# python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "test.py", line 6, in 
    import keyboard
ModuleNotFoundError: No module named 'keyboard'
root@raspberrypi:/home/pi/it# pip3 list
Package           Version    
----------------- -----------
appdirs           1.4.3      
asn1crypto        0.24.0     
astroid           2.1.0      
asttokens         1.1.13     
automationhat     0.2.0      
beautifulsoup4    4.7.1      
blinker           1.4        
blinkt            0.1.2      
buttonshim        0.0.2      
Cap1xxx           0.1.3      
certifi           2018.8.24  
chardet           3.0.4      
Click             7.0        
colorama          0.3.7      
colorzero         1.1        
cookies           2.2.1      
cryptography      2.6.1      
cupshelpers       1.0        
cycler            0.10.0     
decorator         4.3.0      
docutils          0.14       
drumhat           0.1.0      
entrypoints       0.3        
envirophat        1.0.0      
ExplorerHAT       0.4.2      
Flask             1.0.2      
fourletterphat    0.1.0      
gpiozero          1.5.1      
guizero           0.6.0      
html5lib          1.0.1      
idna              2.6        
ipykernel         4.9.0      
ipython           5.8.0      
ipython-genutils  0.2.0      
isort             4.3.4      
itsdangerous      0.24       
jedi              0.13.2     
Jinja2            2.10       
jupyter-client    5.2.3      
jupyter-core      4.4.0      
keyring           17.1.1     
keyrings.alt      3.1.1      
kiwisolver        1.0.1      
lazy-object-proxy 1.3.1      
logilab-common    1.4.2      
lxml              4.3.2      
MarkupSafe        1.1.0      
matplotlib        3.0.2      
mccabe            0.6.1      
microdotphat      0.2.1      
mote              0.0.4      
motephat          0.0.3      
mypy              0.670      
mypy-extensions   0.4.1      
nudatus           0.0.4      
numpy             1.16.2     
oauthlib          2.1.0      
olefile           0.46       
pantilthat        0.0.7      
parso             0.3.1      
pexpect           4.6.0      
pgzero            1.2        
phatbeat          0.1.1      
pianohat          0.1.0      
picamera          1.13       
pickleshare       0.7.5      
picraft           1.0        
piglow            1.2.5      
pigpio            1.78       
Pillow            5.4.1      
pip               18.1       
prompt-toolkit    1.0.15     
psutil            5.5.1      
pycairo           1.16.2     
pycodestyle       2.4.0      
pycrypto          2.6.1      
pycups            1.9.73     
pyflakes          2.0.0      
pygame            1.9.4.post1
Pygments          2.3.1      
PyGObject         3.30.4     
pyinotify         0.9.6      
PyJWT             1.7.0      
pylint            2.2.2      
pyOpenSSL         19.0.0     
pyparsing         2.2.0      
pyserial          3.4        
pysmbc            1.0.15.6   
python-apt        1.8.4.3    
python-dateutil   2.7.3      
pyxdg             0.25       
pyzmq             17.1.2     
qtconsole         4.3.1      
rainbowhat        0.1.0      
reportlab         3.5.13     
requests          2.21.0     
requests-oauthlib 1.0.0      
responses         0.9.0      
roman             2.0.0      
RPi.GPIO          0.7.0      
RTIMULib          7.2.1      
scrollphat        0.0.7      
scrollphathd      1.2.1      
SecretStorage     2.3.1      
semver            2.0.1      
Send2Trash        1.5.0      
sense-emu         1.1        
sense-hat         2.2.0      
setuptools        40.8.0     
simplegeneric     0.8.1      
simplejson        3.16.0     
six               1.12.0     
skywriter         0.0.7      
sn3218            1.2.7      
soupsieve         1.8        
spidev            3.4        
ssh-import-id     5.7        
thonny            3.3.6      
tornado           5.1.1      
touchphat         0.0.1      
traitlets         4.3.2      
twython           3.7.0      
typed-ast         1.3.1      
uflash            1.2.4      
unicornhathd      0.0.4      
urllib3           1.24.1     
wcwidth           0.1.7      
webencodings      0.5.1      
Werkzeug          0.14.1     
wheel             0.32.3     
wrapt             1.10.11    
root@raspberrypi:/home/pi/it# pip3 install keyboard
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting keyboard
  Downloading https://files.pythonhosted.org/packages/55/88/287159903c5b3fc6d47b651c7ab65a54dcf9c9916de546188a7f62870d6d/keyboard-0.13.5-py3-none-any.whl (58kB)
    100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 61kB 617kB/s 
Installing collected packages: keyboard
Successfully installed keyboard-0.13.5
root@raspberrypi:/home/pi/it# pip3 list
Package           Version    
----------------- -----------
appdirs           1.4.3      
asn1crypto        0.24.0     
astroid           2.1.0      
asttokens         1.1.13     
automationhat     0.2.0      
beautifulsoup4    4.7.1      
blinker           1.4        
blinkt            0.1.2      
buttonshim        0.0.2      
Cap1xxx           0.1.3      
certifi           2018.8.24  
chardet           3.0.4      
Click             7.0        
colorama          0.3.7      
colorzero         1.1        
cookies           2.2.1      
cryptography      2.6.1      
cupshelpers       1.0        
cycler            0.10.0     
decorator         4.3.0      
docutils          0.14       
drumhat           0.1.0      
entrypoints       0.3        
envirophat        1.0.0      
ExplorerHAT       0.4.2      
Flask             1.0.2      
fourletterphat    0.1.0      
gpiozero          1.5.1      
guizero           0.6.0      
html5lib          1.0.1      
idna              2.6        
ipykernel         4.9.0      
ipython           5.8.0      
ipython-genutils  0.2.0      
isort             4.3.4      
itsdangerous      0.24       
jedi              0.13.2     
Jinja2            2.10       
jupyter-client    5.2.3      
jupyter-core      4.4.0      
keyboard          0.13.5     
keyring           17.1.1     
keyrings.alt      3.1.1      
kiwisolver        1.0.1      
lazy-object-proxy 1.3.1      
logilab-common    1.4.2      
lxml              4.3.2      
MarkupSafe        1.1.0      
matplotlib        3.0.2      
mccabe            0.6.1      
microdotphat      0.2.1      
mote              0.0.4      
motephat          0.0.3      
mypy              0.670      
mypy-extensions   0.4.1      
nudatus           0.0.4      
numpy             1.16.2     
oauthlib          2.1.0      
olefile           0.46       
pantilthat        0.0.7      
parso             0.3.1      
pexpect           4.6.0      
pgzero            1.2        
phatbeat          0.1.1      
pianohat          0.1.0      
picamera          1.13       
pickleshare       0.7.5      
picraft           1.0        
piglow            1.2.5      
pigpio            1.78       
Pillow            5.4.1      
pip               18.1       
prompt-toolkit    1.0.15     
psutil            5.5.1      
pycairo           1.16.2     
pycodestyle       2.4.0      
pycrypto          2.6.1      
pycups            1.9.73     
pyflakes          2.0.0      
pygame            1.9.4.post1
Pygments          2.3.1      
PyGObject         3.30.4     
pyinotify         0.9.6      
PyJWT             1.7.0      
pylint            2.2.2      
pyOpenSSL         19.0.0     
pyparsing         2.2.0      
pyserial          3.4        
pysmbc            1.0.15.6   
python-apt        1.8.4.3    
python-dateutil   2.7.3      
pyxdg             0.25       
pyzmq             17.1.2     
qtconsole         4.3.1      
rainbowhat        0.1.0      
reportlab         3.5.13     
requests          2.21.0     
requests-oauthlib 1.0.0      
responses         0.9.0      
roman             2.0.0      
RPi.GPIO          0.7.0      
RTIMULib          7.2.1      
scrollphat        0.0.7      
scrollphathd      1.2.1      
SecretStorage     2.3.1      
semver            2.0.1      
Send2Trash        1.5.0      
sense-emu         1.1        
sense-hat         2.2.0      
setuptools        40.8.0     
simplegeneric     0.8.1      
simplejson        3.16.0     
six               1.12.0     
skywriter         0.0.7      
sn3218            1.2.7      
soupsieve         1.8        
spidev            3.4        
ssh-import-id     5.7        
thonny            3.3.6      
tornado           5.1.1      
touchphat         0.0.1      
traitlets         4.3.2      
twython           3.7.0      
typed-ast         1.3.1      
uflash            1.2.4      
unicornhathd      0.0.4      
urllib3           1.24.1     
wcwidth           0.1.7      
webencodings      0.5.1      
Werkzeug          0.14.1     
wheel             0.32.3     
wrapt             1.10.11    
root@raspberrypi:/home/pi/it# python3 test.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
root@raspberrypi:/home/pi/it# python3 music.py 
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
#########\u529f\u80fd\u83dc\u5355#########
# 0.\u64ad\u653e                 #
# 1.\u6682\u505c                 #
# 2.\u7ee7\u7eed                 #
# 3.\u5207\u6b4c                 #
# 4.\u505c\u6b62                 #
##########################
^CTraceback (most recent call last):
  File "music.py", line 98, in 
    elif  keyboard.is_pressed('2'):
  File "/usr/local/lib/python3.7/dist-packages/keyboard/__init__.py", line 417, in is_pressed
    steps = parse_hotkey(hotkey)
  File "/usr/local/lib/python3.7/dist-packages/keyboard/__init__.py", line 344, in parse_hotkey
    scan_codes = key_to_scan_codes(hotkey)
  File "/usr/local/lib/python3.7/dist-packages/keyboard/__init__.py", line 317, in key_to_scan_codes
    t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized)))
  File "/usr/local/lib/python3.7/dist-packages/keyboard/__init__.py", line 317, in 
    t = tuple(_collections.OrderedDict((scan_code, True) for scan_code, modifier in _os_keyboard.map_name(normalized)))
KeyboardInterrupt
root@raspberrypi:/home/pi/it# pip3 install python-opencv
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-opencv
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-opencv/

root@raspberrypi:/home/pi/it# pip3 install opencv
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/opencv/

root@raspberrypi:/home/pi/it# pip3 install opencv-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-python
  Downloading https://www.piwheels.org/simple/opencv-python/opencv_python-4.5.3.56-cp37-cp37m-linux_armv7l.whl (10.4MB)
    100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 10.4MB 40kB/s 
Requirement already satisfied: numpy>=1.14.5 in /usr/lib/python3/dist-packages (from opencv-python) (1.16.2)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.5.3.56
root@raspberrypi:/home/pi/it# 

你可能感兴趣的:(人生苦短,我用python,树莓派,python,opencv)