【问题标题】:Installing tf-models-official on Windows 10在 Windows 10 上安装 tf-models-official
【发布时间】:2021-09-21 09:35:38
【问题描述】:

我正在尝试在装有 Windows 10 的 PC 上安装 tf-models-official。

当我在命令提示符下运行pip install tf-models-official 时,出现以下错误

 Building wheel for pycocotools (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\iavta\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\iavta\\AppData\\Local\\Temp\\pip-install-0twx2hmy\\pycocotools_ebdc747cefa04c81a8aab51eebf9fe53\\setup.py'"'"'; __file__='"'"'C:\\Users\\iavta\\AppData\\Local\\Temp\\pip-install-0twx2hmy\\pycocotools_ebdc747cefa04c81a8aab51eebf9fe53\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\iavta\AppData\Local\Temp\pip-wheel-60i3880o'
       cwd: C:\Users\iavta\AppData\Local\Temp\pip-install-0twx2hmy\pycocotools_ebdc747cefa04c81a8aab51eebf9fe53\
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\pycocotools
  copying pycocotools\coco.py -> build\lib.win-amd64-3.8\pycocotools
  copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.8\pycocotools
  copying pycocotools\mask.py -> build\lib.win-amd64-3.8\pycocotools
  copying pycocotools\__init__.py -> build\lib.win-amd64-3.8\pycocotools
  running build_ext
  cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
  C:\Users\iavta\anaconda3\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\iavta\AppData\Local\Temp\pip-install-0twx2hmy\pycocotools_ebdc747cefa04c81a8aab51eebf9fe53\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
  Running setup.py clean for pycocotools
Successfully built termcolor
Failed to build pycocotools

我已经完成了pip install pycocotools-windows 并且在安装过程中没有任何问题,根据 Vision Studio 安装程序,我已经安装了 Visual Studio 2019 版本 16.11.3。所以,我不知道他们为什么要Microsoft Visual C++ 14.0 or greater

【问题讨论】:

  • 这里的错误表示无法访问构建工具,Visual Studio是IDE,可能没有安装(查看问题here)可以从@下载987654322@.
  • 我还发现了另外两个指向类似问题的问题:herehere
  • @aim97 谢谢!我已经成功下载了 6GB 的 Visual Studio 文件……现在可以使用了。 =D(尽管大小很开心...)
  • 恭喜,Visual Studio 有一个下载的恶性循环,直到问题解决。 :D.

标签: tensorflow


【解决方案1】:

我通过以下方式解决了 Windows 10 anaconda (python=3.9) 上恼人的“pycocotools 构建轮失败”问题:

  1. 卸载 Visual Studio 2019;
  2. 卸载所有 Visual C++ Redistributable(2015-2019、2013、2012 等);
  3. 安装 Visual Studio 2022,并勾选使用 C++ 进行桌面开发。
  4. 激活新的虚拟环境,然后运行“pip install tf-models-official”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-14
    • 2021-03-15
    • 2018-03-22
    • 2018-06-19
    • 2020-05-18
    • 2018-07-18
    • 2020-06-23
    • 2021-12-10
    相关资源
    最近更新 更多