【问题标题】:pycocotools - "Microsoft Visual C++ 14.0 or greater is required" although installedpycocotools - 尽管已安装,但“需要 Microsoft Visual C++ 14.0 或更高版本”
【发布时间】:2021-12-30 19:14:49
【问题描述】:

我想安装 TensorFlow 对象检测 API,为此,我需要依赖 Visual Studio C++ Build Tools v14 或更高版本的 pycocotools 包。

我都尝试单独安装完整的 Visual Studio 2022 以及 Visual Studio 构建工具 2019。不管我做什么,这都是我的错误信息:

Building wheel for pycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\envs\tensorflow\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\linus\\AppData\\Local\\Temp\\pip-install-qcu6kn44\\pycocotools_48badac11907450f8dc23c6ec17df5de\\setup.py'"'"'; __file__='"'"'C:\\Users\\linus\\AppData\\Local\\Temp\\pip-install-qcu6kn44\\pycocotools_48badac11907450f8dc23c6ec17df5de\\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 'C:\Users\linus\AppData\Local\Temp\pip-wheel-d2xbzptl'
       cwd: C:\Users\linus\AppData\Local\Temp\pip-install-qcu6kn44\pycocotools_48badac11907450f8dc23c6ec17df5de\
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
  running build_ext
  cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
  C:\ProgramData\Anaconda3\envs\tensorflow\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\linus\AppData\Local\Temp\pip-install-qcu6kn44\pycocotools_48badac11907450f8dc23c6ec17df5de\pycocotools\_mask.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'pycocotools._mask' extension
  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/
  ----------------------------------------
  ERROR: Failed building wheel for pycocotools

我在安装了 Anaconda3 2021.11(Python 3.9.7 64 位)的 Windows 11 机器上。

我在 Visual Studio 安装程序中的安装详细信息如下所示 this.

非常感谢您的帮助。

【问题讨论】:

    标签: python c++ visual-studio tensorflow visual-c++


    【解决方案1】:

    我相信您缺少 MSBuild。您可以从 Visual Studio 安装程序中添加它。

    Here 是我安装的,pycocotools 安装正常。

    【讨论】:

    • 不幸的是,这没有帮助...我仍然收到相同的错误消息
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-19
    • 2021-09-15
    • 2021-12-04
    • 1970-01-01
    • 1970-01-01
    • 2020-05-13
    • 2022-01-17
    相关资源
    最近更新 更多