Building wheel for pycocotools (pyproject.toml) … error错误解决
在准备langchain-ChatGLM开发环境时,运行pip install -r requirements.txt报错:
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
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-38
creating build\lib.win-amd64-cpython-38\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-cpython-38\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-cpython-38\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-cpython-38\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-cpython-38\pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
building 'pycocotools._mask' extension
C:\Users\yinya\AppData\Local\Temp\pip-build-env-eqa_vojh\overlay\Lib\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: C:\Users\yinya\AppData\Local\Temp\pip-install-744av186\pycocotools_f9d1ea1aa1fa4507a8979cca130787ef\pycocotools\_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[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 sentence-transformers fire ffmpy iopath python-docx python-pptx sgmllib3k olefile antlr4-python3-runtime
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
解决:
到 https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/ 页面下载生成工具:
运行工具vs_BuildTools.exe,然后勾选使用c++的桌面开发:
安装完成:
重新执行pip命令即可。