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++的桌面开发:
安装vs_BuildTools
安装完成:
在这里插入图片描述
重新执行pip命令即可。

python package通常作为"wheels" (.whl files)来分发,通常为预编译的二进制文件,刚刚的指令正式采用wheels来安装,而非使用源文件安装包。执行pip install websocket的过程中出现上述安装问题,显示greenlet安装出现问题,手动执行以下指令安装greenlet成功。 odoo安装 python-ldap 报错pyproject.toml-based,实际上,这个是一个Python3 安装报错。执行组件更新 sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev Traceback (most recent call last): File "D:\python\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\python\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "D:\python\lib\sit 本课程使用YOLOv5和DeepSORT对视频中的行人、车辆做多目标跟踪和计数,开展YOLOv5目标检测和DeepSORT多目标跟踪强强联手的应用。 课程分别在Windows和Ubuntu系统上做项目演示,并对DeepSORT原理和代码做详细解读(使用PyCharm单步调试讲解)。 课程包括:基础篇、实践篇、原理篇和代码解析篇。Ÿ  基础篇包括多目标跟踪任务介绍、数据集和评估指标;Ÿ  实践篇包括Win10和Ubuntu系统上的YOLOv5+DeepSORT的多目标跟踪和计数具体的实践操作步骤演示,特别是对行人、车辆的ReID数据集讲解了训练方法;Ÿ  原理篇中讲解了马氏距离、匈牙利算法、卡尔曼滤波器的原理,并解读了SORT和DeepSORT论文;Ÿ  代码解析篇中使用PyCharm单步调试对DeepSORT的代码逐个文件进行讲解。课程提供注释后的代码。 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 请记住,始终保持您的构建工具是最新的,以避免将来出现类似的错误。尝试3,如果需要安装10版本的pillow包,遇到无法安装报错Building wheel for Pillow error的情况,百度文库上有一篇文章,我觉得可行度很高。我记得曾经也有不少其他的tar.gz格式的包不能安装,最后我网上下载他的whl格式的包直接离线安装成功的,对于别的包这也算是一个通用尝试办法吧。主要看这个,尽量选9点几的版本,因为我感觉9点几的应该是whl包。10点几版本都是自动下载的 .tar.gz包一个有50M大。 × Building wheel for python-ldap (pyproject.toml) did not run successfully. 报错