yolov5安装pip install requirements.txt,pycocotools安装报错

项目场景:

系统:ubuntu16.04

安装yolov5,直接pip install requirements.txt,报错


问题描述:

报错信息如下,可见是pycocotools安装错误

Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /root/anaconda3/envs/yolov5/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hemp_z72/pycocotools_a290c0ec5b984c809bb56fa10ca801ce/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hemp_z72/pycocotools_a290c0ec5b984c809bb56fa10ca801ce/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kkrnoozi
       cwd: /tmp/pip-install-hemp_z72/pycocotools_a290c0ec5b984c809bb56fa10ca801ce/
  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/__init__.py -> build/lib.linux-x86_64-3.7/pycocotools
  copying pycocotools/coco.py -> 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
  running build_ext
  cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
  /root/anaconda3/envs/yolov5/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-hemp_z72/pycocotools_a290c0ec5b984c809bb56fa10ca801ce/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 /root/anaconda3/envs/yolov5/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/anaconda3/envs/yolov5/lib/python3.7/site-packages/numpy/core/include -I./common -I/root/anaconda3/envs/yolov5/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
  Running setup.py clean for pycocotools
Failed to build pycocotools

解决方案:

出现这种情况的原因在于gcc未正确安装,导致系统找不到gcc安装位置,重新安装,如下

sudo apt-get install gcc

再安装pycocotools即可

pip install pycocotools  -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值