想在树莓派上用GPIO玩I2C OLED屏幕,不料卡在安装Adafruit_BBIO这个库上面。

爆了一大坨东西,最后输出:

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
?─> Adafruit_BBIO

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

最后在这个库的一个issue下找到了解决方案:

sudo apt-get update
sudo apt-get install build-essential python-dev python-pip python-smbus -y
git clone git://github.com/adafruit/adafruit-beaglebone-io-python.git
cd adafruit-beaglebone-io-python
sudo python setup.py install
cd ..
sudo rm -rf adafruit-beaglebone-io-python

最后我实际执行的时候,跳过了前两条,是这样执行的:

sudo git clone https://github.com/adafruit/adafruit-beaglebone-io-python.git
cd adafruit-beaglebone-io-python
sudo python setup.py install
cd ..
sudo rm -rf adafruit-beaglebone-io-python

安装成功。