我是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/
答案 0 :(得分:0)
安装build-essential
代替gcc
可以使您工作,请参阅official git。
实际上,在构建某些源代码时,始终最好安装build-essential
,因为它不仅会安装gcc
,还会安装一些开发软件包。您的错误fatal error: limits.h: No such file or directory
是因为错过了这些开发包。
总而言之,next会为您服务:
RUN sudo apt-get update && apt-get -y install build-essential