SSD1306无法驱动

Tony 219m2020-09-271468 次点击
按照[教程](https://shumeipai.nxez.com/2019/04/29/use-the-ssd1306-oled-display-on-the-raspberry-pi.html)做了。
有两个问题:
```bash
pi@raspberrypi:~ $ sudo pip2 install Adafruit-SSD1306
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: Adafruit-SSD1306 in /usr/local/lib/python2.7/dist-packages/Adafruit_SSD1306-1.6.2-py2.7.egg (1.6.2)
Requirement already satisfied: Adafruit-GPIO>=0.6.5 in /usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.4-py2.7.egg (from Adafruit-SSD1306) (1.0.4)
Requirement already satisfied: adafruit-pureio in /usr/local/lib/python2.7/dist-packages/Adafruit_PureIO-1.1.5-py2.7.egg (from Adafruit-GPIO>=0.6.5->Adafruit-SSD1306) (1.1.5)
ERROR: Package 'Adafruit-PureIO' requires a different Python: 2.7.16 not in '>=3.5.0'
```

```bash
pi@raspberrypi:~ $ sudo python stats.py
Traceback (most recent call last):
File "stats.py", line 47, in <module>
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 288, in __init__
File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/GPIO.py", line 420, in get_platform_gpio
ImportError: No module named Adafruit_BBIO.GPIO
```

```ERROR: Package 'Adafruit-PureIO' requires a different Python: 2.7.16 not in '>=3.5.0```
应该就是这个问题。
收藏 ♥ 感谢
Spoony 小组长 2020-09-27 
你用的命令并不是这个教程里面的。请用下面的:

sudo python -m pip install --upgrade pip setuptools wheel
sudo apt-get remove python-pip python3-pip
sudo apt-get install python-pip python3-pip
sudo apt-get install python-pil python3-pil
sudo pip install Adafruit-SSD1306
Tony 219m 2020-09-27 
@Spoony OK,另外可以用非1-6针脚吗?因为还要接风扇,而且外壳盖不上了...
Spoony 小组长 2020-09-28 
这个只能二选一。。
Tony 219m 2020-10-02 
@Spoony 貌似Adafruit-SSD1306只能用pip3安装
而pip=pip2
Spoony 小组长 2020-10-02 
@Tony 是的,必须 pip3
Tony 219m 2020-10-02 
@Spoony 又试了一下,还是不行
pi@raspberrypi:~ $ sudo python stats.py
Traceback (most recent call last):
File "stats.py", line 47, in <module>
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 288, in __init__
File "build/bdist.linux-armv7l/egg/Adafruit_SSD1306/SSD1306.py", line 85, in __init__
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/GPIO.py", line 420, in get_platform_gpio
ImportError: No module named Adafruit_BBIO.GPIO
RaspiSQH 120.5m 2020-10-02 
@Tony
建议全用pip3/python3
你用到“python” 是2.7 应该用 python3 xx.py
没想到你也会被坑

登录注册 后可回复。




› 相关内容关注微信公众号