尝试在python:alpine基本映像上安装Flask_MySQL软件包时遇到此错误。有人知道为什么会这样吗?
错误:
cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql -I/usr/local/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.7/MySQLdb/_mysql.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jvwb1s5k/mysqlclient/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-p8tkehmf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-jvwb1s5k/mysqlclient/
这是我的docker文件:
FROM python:alpine
COPY . /app
WORKDIR /app
RUN apk add python3-dev
RUN apk add libevent-dev
RUN apk add mysql-client
RUN apk add mariadb-dev
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
EXPOSE 5000
CMD python ./app.py
答案 0 :(得分:0)
必须安装gcc和依赖项 musl-libc