ERROR:Could not build wheels for pycocotools,which is required to install pyproject.toml-based proje

1 安装pycocotools错误

在ubuntu 上安装pycocotools爆出如下错误

  Building wheel for pycocotools (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.6 /home/unitree/.local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /home/unitree/tmp/tmpu2bm6bfm
       cwd: /home/unitree/tmp/pip-install-n_d33dck/pycocotools_b2ce23b413cc409b88f2a28c6d4c7892
  Complete output (67 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/pycocotools
  copying pycocotools/coco.py -> build/lib.linux-x86_64-3.6/pycocotools
  copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.6/pycocotools
  copying pycocotools/mask.py -> build/lib.linux-x86_64-3.6/pycocotools
  copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.6/pycocotools
  running build_ext
  skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
  building 'pycocotools._mask' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/common
  creating build/temp.linux-x86_64-3.6/pycocotools
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/unitree/tmp/pip-build-env-fvy_tqfo/overlay/lib/python3.6/site-packages/numpy/core/include -I./common -I/usr/include/python3.6m -c ./common/maskApi.c -o build/temp.linux-x86_64-3.6/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
  ./common/maskApi.c: In function ‘rleDecode’:
  ./common/maskApi.c:46:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
     46 |       for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
        |       ^~~
  ./common/maskApi.c:46:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
     46 |       for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
        |                                                 ^
  ./common/maskApi.c: In function ‘rleToBbox’:
  ./common/maskApi.c:135:32: warning: unused variable ‘xp’ [-Wunused-variable]
    135 |     uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
        |                                ^~
  ./common/maskApi.c: In function ‘rleFrPoly’:
  ./common/maskApi.c:181:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
    181 |   for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
        |   ^~~
  ./common/maskApi.c:181:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
    181 |   for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
        |                                                      ^
  ./common/maskApi.c:182:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
    182 |   for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
        |   ^~~
  ./common/maskApi.c:182:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
    182 |   for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
        |                                                      ^
  ./common/maskApi.c: In function ‘rleToString’:
  ./common/maskApi.c:227:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    227 |       if(more) c |= 0x20; c+=48; s[p++]=c;
        |       ^~
  ./common/maskApi.c:227:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
    227 |       if(more) c |= 0x20; c+=48; s[p++]=c;
        |                           ^
  ./common/maskApi.c: In function ‘rleFrString’:
  ./common/maskApi.c:235:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
    235 |   while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
        |   ^~~~~
  ./common/maskApi.c:235:22: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
    235 |   while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
        |                      ^~~~
  ./common/maskApi.c:243:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    243 |     if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
        |     ^~
  ./common/maskApi.c:243:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
    243 |     if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
        |                                  ^~~~
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/unitree/tmp/pip-build-env-fvy_tqfo/overlay/lib/python3.6/site-packages/numpy/core/include -I./common -I/usr/include/python3.6m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.6/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
  pycocotools/_mask.c:4:10: fatal error: Python.h: No such file or directory
      4 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

原因:

极大可能是缺少pythonX-dev

解决:

安装对应python的dev即可

sudo apt install python3.6-dev

猜你喜欢

转载自blog.csdn.net/u011573853/article/details/132193066
今日推荐