如何解决在 Docker 上安装检测器 2 包
我使用的是 python 3.7.9 版本。 dectron2 安装不正确。 命令: docker exec -it 1ee02b74a599 /bin/bash root@1ee02b74a599:/app# pip install detectionron2==0.2.1 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.4/index.html
安装过程中出现以下问题。
*Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /opt/conda/bin/python -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nmjk8ssb/pycocotools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nmjk8ssb/pycocotools/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-x7z500uh
cwd: /tmp/pip-install-nmjk8ssb/pycocotools/
Complete output (21 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.7/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-3.7/pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
/opt/conda/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set,using 2 for Now (Py2). This will change in a later release! File: /tmp/pip-install-nmjk8ssb/pycocotools/pycocotools/_mask.pyx
tree = Parsing.p_module(s,pxd,full_module_name)
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/common
creating build/temp.linux-x86_64-3.7/pycocotools
gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/Opt/conda/lib/python3.7/site-packages/numpy/core/include -I./common -I/Opt/conda/include/python3.7m -c ./common/maskApi.c -o build/temp.linux-x86_64-3.7/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute 'gcc': No such file or directory
error: command 'gcc' Failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pycocotools*
解决方法
请检查您在 Dockerfile 中使用的 python 映像,也许您看到此错误的原因是您使用的是删除 gcc 以使其尽可能小的 alpine 或 slim 映像,然后使用这些映像像 python:3.7 或 ...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。