gpt4 book ai didi

python-3.x - "Failed to build regex"当 docker 's image of "python :3. 5-alpine"构建时

转载 作者:行者123 更新时间:2023-12-02 18:18:06 25 4
gpt4 key购买 nike

我正在尝试使用以下 dockerfile 构建 python 的 docker 镜像:您能帮忙澄清一下吗?

FROM python:3.5-alpine
COPY sa /app
WORKDIR /app
RUN pip3 install -r requirements.txt && \
python3 -m textblob.download_corpora
EXPOSE 6000
ENTRYPOINT ["python3"]
CMD ["sentiment_analysis.py"]

当我尝试构建时,我遇到了这个错误:

Building wheel for regex (setup.py): started
**Building wheel for regex (setup.py): finished with status 'error**'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uf5dc85t/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uf5dc85t/regex/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-soszwszs
cwd: /tmp/pip-install-uf5dc85t/regex/
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/regex
copying regex_3/__init__.py -> build/lib.linux-x86_64-3.5/regex
copying regex_3/regex.py -> build/lib.linux-x86_64-3.5/regex
copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.5/regex
copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.5/regex
running build_ext
building 'regex._regex' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/regex_3
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict- prototypes -fPIC -I/usr/local/include/python3.5m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.5/regex_3/_regex.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
**ERROR: Failed building wheel for regex**
Running setup.py clean for regex
Successfully built nltk MarkupSafe
Failed to build regex

最佳答案

建议Stefano后在 FROM 指令之后添加 RUN apk add build-base - 它有效!谢谢,斯特凡诺!

关于python-3.x - "Failed to build regex"当 docker 's image of "python :3. 5-alpine"构建时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61589492/

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