​
LNT@raspberrypi1:~/Adafruit_Python_SSD1306/examples $ python3 stats.py
Traceback (most recent call last):
  File "/home/LNT/Adafruit_Python_SSD1306/examples/stats.py", line 26, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

Adafruit_Python_SSD1306库中给了一个实例库,运行出错,原因为没有PIL库。
PIL模块全称是Python Imaging Library。
早先我按照树莓派实验室的教程运行了sudo apt-get install python-pil python3-pil
但是报错 E: Unable to locate package python-pil

LNT@raspberrypi1:~ $ sudo apt-get install python-pil python3-pil
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-pil

正确操作:直接在pip内安装PIL库。

pip install -i https://pypi.douban.com/simple pillow

整个包大概3.1M,官方源太慢,用豆瓣源会快很多。