简体   繁体   English

在 Mac m1 中安装 pycocotools

[英]install pycocotools in Mac m1

python 3.9 pip 22.3.1 setuptools 66.0.0 wheel 0.38.4 python 3.9 pip 22.3.1 setuptools 66.0.0 轮子 0.38.4

when install yolox, there is always error in installing pycocotools as below:安装yolox时,安装pycocotools总是报错如下:

× Building wheel for pycocotools (pyproject.toml) did not run successfully. × pycocotools (pyproject.toml) 的构建轮未成功运行。 │ exit code: 1 ╰─> [33 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-universal2-cpython-39 creating build/lib.macosx-10.9-universal2-cpython-39/pycocotools copying pycocotools/coco.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools copying pycocotools/mask.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools copying pycocotools/ init .py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools copying pycocotools/cocoeval.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools running build_ext cythoning pycocotools/_mask.pyx to pycocotools/ mask.c /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki /overlay/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). │ 退出代码:1 ╰─> [33 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-universal2-cpython-39 creating build/lib.macosx-10.9-universal2-cpython-39 /pycocotools 复制 pycocotools/coco.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools 复制 pycocotools/mask.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools 复制 pycocotools / init .py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools 复制 pycocotools/cocoeval.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools running build_ext cythoning pycocotools/_mask .pyx 到 pycocotools/ mask.c /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki /overlay/lib/python3.9/site-packages/Cython/Compiler/Main.py:369 : FutureWarning: Cython 指令 'language_level' 未设置,现在使用 2 (Py2)。 This will change in a later release: File: /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-install-zc58cnkb/pycocotools_f63b404805f6427bb06acdd61bfd63a0/pycocotools/ mask.pyx tree = Parsing.p_module(s, pxd, full_module_name) building 'pycocotools.这将在以后的版本中更改:文件: /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-install-zc58cnkb/pycocotools_f63b404805f6427bb06acdd61bfd63a0/pycocotools/mask.pyx tree = Parsing.p_module, full_module(s, px_module) pycocotools。 mask' extension creating build/temp.macosx-10.9-universal2-cpython-39 creating build/temp.macosx-10.9-universal2-cpython-39/common creating build/temp.macosx-10.9-universal2-cpython-39/pycocotools clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki /overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c./common/maskApi.c -o build/temp.macosx-10.9-universal2-cpython-39/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99./common mask' 扩展创建 build/temp.macosx-10.9-universal2-cpython-39 创建 build/temp.macosx-10.9-universal2-cpython-39/common 创建 build/temp.macosx-10.9-universal2-cpython-39/pycocotools clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode .app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=隐式函数声明 -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip -build-env-kb70uki /overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/目录/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c./common/maskApi.c -o build/temp.macosx-10.9-universal2-cpython-39/./common/maskApi.o - Wno-cpp -Wno-unused-function -std=c99./common /maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable] uint h, w, xs, ys, xe, ye, xp, cc; /maskApi.c:151:32:警告:未使用的变量“xp”[-Wunused-variable] uint h、w、xs、ys、xe、ye、xp、cc; siz j, m;尺寸 j, m; ^ 1 warning generated. ^ 产生 1 个警告。 ./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable] uint h, w, xs, ys, xe, ye, xp, cc; ./common/maskApi.c:151:32: 警告:未使用的变量 'xp' [-Wunused-variable] uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;尺寸 j, m; ^ 1 warning generated. ^ 产生 1 个警告。 clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki /overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c pycocotools/_mask.c -o build/temp.macosx-10.9-universal2-cpython-39/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99 pycocotools/_mask.c:6:10: fatal error: 'Python.h' file not found #include "Python.h" ^~~~~~~~~~ 1 error generated. clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/ Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/ pip-build-env-kb70uki /overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app /Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c pycocotools/_mask.c -o build/temp.macosx-10.9-universal2-cpython-39/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99 pycocotools/_mask.c:6:10: fatal error: 'Python.h' file not found #include "Python.h" ^~~~~~~~~~ 1个错误生成。 error: command '/usr/bin/clang' failed with exit code 1 [end of output]错误:命令“/usr/bin/clang”失败,退出代码为 1 [输出结束]

note: This error originates from a subprocess, and is likely not a problem with pip. 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注意:此错误源于子进程,可能不是 pip 的问题。

so i goto pycocotools website to downlord whl file.所以我转到 pycocotools 网站下载 whl 文件。 https://pypi.tuna.tsinghua.edu.cn/simple/pycocotools-windows/ and got error as below https://pypi.tuna.tsinghua.edu.cn/simple/pycocotools-windows/报错如下

ERROR: pycocotools_windows-2.0.0.2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.错误:pycocotools_windows-2.0.0.2-cp37-cp37m-win_amd64.whl 在此平台上不受支持。

any suggestion?有什么建议吗? thanks a lot多谢

solution: use miniforge to install conda解决方案:使用miniforge安装conda

and install pycocotools with conda in Mac m1.并在 Mac m1 中使用 conda 安装 pycocotools。 It works, no error anymore成功了,没有错误了

however pip install in conda env is a little bit complicated,然而 pip 在 conda env 中安装有点复杂,

i am tring it.我正在尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM