gpt4 book ai didi

docker - 如何在Docker中安装Adafruit-GPIO库

转载 作者:行者123 更新时间:2023-12-02 19:57:54 24 4
gpt4 key购买 nike

我是Docker的新手,所以可能我做错了什么。我正在尝试在容器中安装Adafruit-GPIO,但我一直收到此错误,并且不确定如何解决。我正在使用Powershell在Windows 10 pc上本地构建文件。

我已经确保正确安装了GCC。我一直在网上寻找答案,没有什么可做的。

Dockerfile:

FROM balenalib/raspberry-pi-debian-python:3.7.2

RUN pip3 install --upgrade pip
RUN sudo pip3 install --upgrade setuptools
RUN sudo apt-get update && apt-get -y install gcc
RUN pip3 install adafruit-gpio

我希望该文件能够编译并成功工作。取而代之的是我
    ERROR: Complete output from command /usr/local/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-qfol0jyh/spidev/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-i37a5wvt/install-record.txt -
-single-version-externally-managed --compile:
ERROR: running install
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.linux-armv6l-3.7
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c spidev_module.c -o build/temp.linux-armv6l-3.7/spidev_module.o
In file included from /usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/syslimits.h:7:0,
from /usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/limits.h:34,
from /usr/local/include/python3.7m/Python.h:11,
from spidev_module.c:28:
/usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next <limits.h> /* recurse down to the real one */
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-qfol0jyh/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);cod
e=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-i37a5wvt/install-record.txt --single-version-external
ly-managed --compile" failed with error code 1 in /tmp/pip-install-qfol0jyh/spidev/

最佳答案

安装build-essential替换gcc可能会使您工作,请参阅official git

实际上,在构建一些源代码时,始终最好安装build-essential,因为它不仅会安装gcc,还会安装一些dev软件包。您的错误fatal error: limits.h: No such file or directory只是因为错过了这些dev软件包。

总之,next将为您工作:

RUN sudo apt-get update && apt-get -y install build-essential

关于docker - 如何在Docker中安装Adafruit-GPIO库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56653515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com