【发布时间】:2020-06-12 20:15:07
【问题描述】:
我正在尝试使用python模块asyncpg构建基于python:3-8.alpine的图像。
这是我的 Dockerfile 的一部分:
FROM python:3.8-alpine
RUN apk add gcc
RUN apk add python3-dev
RUN pip3 install asyncpg
我添加了gcc 和python3-dev,因为我认为我需要它们能够根据文档构建asyncpg:https://magicstack.github.io/asyncpg/current/installation.html(但我不确定,我想我应该能够无需构建此模块即可安装)
但是我在构建镜像时出现以下错误:
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.8 -c asyncpg/pgproto/pgproto.c -o build/temp.linux-x86_64-3.8/asyncpg/pgproto/pgproto.o -O2 -fsigned-char -Wall -Wsign-compare -Wconversion
In file included from asyncpg/pgproto/pgproto.c:29:
/usr/local/include/python3.8/Python.h:11:10: fatal error: limits.h: No such file or directory
11 | #include <limits.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
如何解决此错误并安装 asyncpg ?
谢谢
【问题讨论】:
标签: python docker alpine asyncpg