Python 使用pip安装Adafru BBIO库时出错

Python 使用pip安装Adafru BBIO库时出错,python,linux,pip,debian,beagleboneblack,Python,Linux,Pip,Debian,Beagleboneblack,我目前在Beaglebone black(Debian 10 buster)上安装Adafruit_BBIO库时遇到一些问题。 我收到错误消息“为Adafruit BBIO构建轮子失败”,信息如下: 当我尝试运行代码时 sudo pip install Adafruit_BBIO 我得到以下输出,其中包含错误消息 root@beaglebone:~# sudo pip install Adafruit_BBIO Collecting Adafruit_BBIO Using cached h

我目前在Beaglebone black(Debian 10 buster)上安装Adafruit_BBIO库时遇到一些问题。 我收到错误消息“为Adafruit BBIO构建轮子失败”,信息如下: 当我尝试运行代码时

sudo pip install Adafruit_BBIO
我得到以下输出,其中包含错误消息

root@beaglebone:~# sudo pip install Adafruit_BBIO
Collecting Adafruit_BBIO
  Using cached https://files.pythonhosted.org/packages/53/2b/b0e3dce6113225aae9beb886b2addd4fd5c140ba93c9503d7e4a97021bcc/Adafruit_BBIO-1.1.1.tar.gz
Building wheels for collected packages: Adafruit-BBIO
  Running setup.py bdist_wheel for Adafruit-BBIO ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-n7NVjA/Adafruit-BBIO/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-qbYwCh --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-2.7
  copying Adafruit_I2C.py -> build/lib.linux-armv7l-2.7
  creating build/lib.linux-armv7l-2.7/Adafruit_BBIO
  copying Adafruit_BBIO/sysfs.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
  copying Adafruit_BBIO/__init__.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
  copying Adafruit_BBIO/Encoder.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
  creating build/lib.linux-armv7l-2.7/overlays
  copying overlays/__init__.py -> build/lib.linux-armv7l-2.7/overlays
  copying overlays/builder.py -> build/lib.linux-armv7l-2.7/overlays
  running build_ext
  building 'Adafruit_BBIO.GPIO' extension
  creating build/temp.linux-armv7l-2.7
  creating build/temp.linux-armv7l-2.7/source
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-C6mgOs/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DBBBVERSION41 -Isource/include/ -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv7l-2.7/source/py_gpio.o -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-strict-aliasing
  source/py_gpio.c:558:14: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
      {"setup", (PyCFunction)py_setup_channel, METH_VARARGS | METH_KEYWORDS, "Set up the GPIO channel, direction and (optional) pull/up down control\nchannel        - Either: RPi board pin number (not BCM GPIO 00..nn number).  Pins start from 1\n                 or    : BCM GPIO number\ndirection      - INPUT or OUTPUT\n[pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN\n[initial]      - Initial value for an output channel\n[delay]        - Time in milliseconds to wait after exporting gpio pin"},
                ^
  source/py_gpio.c:562:25: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
      {"add_event_detect", (PyCFunction)py_add_event_detect, METH_VARARGS | METH_KEYWORDS, "Enable edge detection events for a particular GPIO channel.\nchannel      - either board pin number or BCM number depending on which mode is set.\nedge         - RISING, FALLING or BOTH\n[callback]   - A callback function for the event (optional)\n[bouncetime] - Switch bounce timeout in ms for callback"},
                           ^
  source/py_gpio.c:565:27: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
      {"add_event_callback", (PyCFunction)py_add_event_callback, METH_VARARGS | METH_KEYWORDS, "Add a callback for an event already defined using add_event_detect()\ngpio         - gpio channel\ncallback     - a callback function\n[bouncetime] - Switch bounce timeout in ms"},
                             ^
  cc1: all warnings being treated as errors
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for Adafruit-BBIO
  Running setup.py clean for Adafruit-BBIO
Failed to build Adafruit-BBIO
Installing collected packages: Adafruit-BBIO
  Running setup.py install for Adafruit-BBIO ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-n7NVjA/Adafruit-BBIO/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-wOX_dm/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-2.7
    copying Adafruit_I2C.py -> build/lib.linux-armv7l-2.7
    creating build/lib.linux-armv7l-2.7/Adafruit_BBIO
    copying Adafruit_BBIO/sysfs.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
    copying Adafruit_BBIO/__init__.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
    copying Adafruit_BBIO/Encoder.py -> build/lib.linux-armv7l-2.7/Adafruit_BBIO
    creating build/lib.linux-armv7l-2.7/overlays
    copying overlays/__init__.py -> build/lib.linux-armv7l-2.7/overlays
    copying overlays/builder.py -> build/lib.linux-armv7l-2.7/overlays
    running build_ext
    building 'Adafruit_BBIO.GPIO' extension
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/source
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-C6mgOs/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DBBBVERSION41 -Isource/include/ -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv7l-2.7/source/py_gpio.o -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-strict-aliasing
    source/py_gpio.c:558:14: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
        {"setup", (PyCFunction)py_setup_channel, METH_VARARGS | METH_KEYWORDS, "Set up the GPIO channel, direction and (optional) pull/up down control\nchannel        - Either: RPi board pin number (not BCM GPIO 00..nn number).  Pins start from 1\n                 or    : BCM GPIO number\ndirection      - INPUT or OUTPUT\n[pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN\n[initial]      - Initial value for an output channel\n[delay]        - Time in milliseconds to wait after exporting gpio pin"},
                  ^
    source/py_gpio.c:562:25: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
        {"add_event_detect", (PyCFunction)py_add_event_detect, METH_VARARGS | METH_KEYWORDS, "Enable edge detection events for a particular GPIO channel.\nchannel      - either board pin number or BCM number depending on which mode is set.\nedge         - RISING, FALLING or BOTH\n[callback]   - A callback function for the event (optional)\n[bouncetime] - Switch bounce timeout in ms for callback"},
                             ^
    source/py_gpio.c:565:27: error: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Werror=cast-function-type]
        {"add_event_callback", (PyCFunction)py_add_event_callback, METH_VARARGS | METH_KEYWORDS, "Add a callback for an event already defined using add_event_detect()\ngpio         - gpio channel\ncallback     - a callback function\n[bouncetime] - Switch bounce timeout in ms"},
                               ^
    cc1: all warnings being treated as errors
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-n7NVjA/Adafruit-BBIO/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-wOX_dm/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-n7NVjA/Adafruit-BBIO/

如果有人能帮我解决这个问题,我将不胜感激。谢谢。

您可以选择手动安装。为此,应运行以下命令:

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 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

在尝试此操作之前,您是否遵循了预先要求?是的,这就是我关注的网页。我能够安装依赖项,并且我有最新版本的debian,因此我认为我不需要修补dtc。另一方面,他们为dtc提供的链接并没有具体说明从何处获取dtc。在查看其他类似问题时,有人建议如下:“确保在raspi_配置中启用SPI”,“cd rpi_ws2811x”和“run scons”看看是否有帮助。我有一个beaglebone黑色,而不是pi,所以我必须通过uEnv.txt打开spi引脚。不幸的是,这并没有解决问题。啊,很抱歉,我无法帮助@programmer25,这里有一个类似的线程,我想阅读一下,看看你是否能找到它的底部。在尝试之前,你是否遵循了prereq?是的,这就是我关注的网页。我能够安装依赖项,并且我有最新版本的debian,因此我认为我不需要修补dtc。另一方面,他们为dtc提供的链接并没有具体说明从何处获取dtc。在查看其他类似问题时,有人建议如下:“确保在raspi_配置中启用SPI”,“cd rpi_ws2811x”和“run scons”看看是否有帮助。我有一个beaglebone黑色,而不是pi,所以我必须通过uEnv.txt打开spi引脚。不幸的是,这并没有解决问题。啊,很抱歉,我无法帮助@programmer25,这里有一个类似的线程,我会阅读一下,看看你是否能找到它的底部