按照手册“9.算法工具链开发指南”的“9.2入门指南”中,解压模型转换环境和示例模型安装包并进行相关依赖的安装,执行如下命令时:
pip install ai_toolchain/h* -i https://mirrors.aliyun.com/pypi/simple
报错:
Building wheel for pycocotools (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-38/pycocotools
running build_ext
Compiling pycocotools/_mask.pyx because it changed.
[1/1] Cythonizing pycocotools/_mask.pyx
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/common
creating build/temp.linux-x86_64-cpython-38/pycocotools
gcc -pthread -B /home/sunrise/miniconda3/envs/bpu/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-_3yrh9ll/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/home/sunrise/miniconda3/envs/bpu/include/python3.8 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-38/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
/tmp/pip-build-env-_3yrh9ll/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-i_04snxj/pycocotools_b43449b98e2844cd9fb40168b0a86254/pycocotools/_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Successfully built easydict pathos
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
解决方法:
sudo apt-get install python3-dev
sudo apt-get install gcc
在Ubuntu中使用apt-get前建议先换源。
参考:x86_64-linux-gnu-gcc failed 和 ERROR: Failed building wheel for Twisted 错误_这个饕字怎么读的博客-CSDN博客