首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在pip上安装tf2onnx时出错

在pip上安装tf2onnx时出错
EN

Stack Overflow用户
提问于 2022-02-04 21:15:59
回答 2查看 2.1K关注 0票数 1

我正在尝试将我的.pb模型转换为.onnx,为此,我正在使用pip安装tf2onnx。但是,这样做,我一直会得到以下错误

代码语言:javascript
运行
复制
C:\Users\HC>pip install -U tf2onnx
Collecting tf2onnx
  Using cached tf2onnx-1.9.3-py3-none-any.whl (435 kB)
Collecting flatbuffers~=1.12
  Using cached flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: numpy>=1.14.1 in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (1.22.1)
Requirement already satisfied: requests in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (2.27.1)
Requirement already satisfied: six in c:\users\hc\appdata\local\programs\python\python310\lib\site-packages (from tf2onnx) (1.16.0)
Collecting onnx>=1.4.1
  Using cached onnx-1.10.2.tar.gz (9.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Traceback (most recent call last):
        File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\HC\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "C:\Users\HC\AppData\Local\Temp\pip-build-env-qij5_ixj\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 86, in <module>
          assert CMAKE, 'Could not find "cmake" executable!'
      AssertionError: Could not find "cmake" executable!
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

请有人指导一下如何解决这个问题。

EN

回答 2

Stack Overflow用户

发布于 2022-02-04 21:25:04

AssertionError: Could not find "cmake" executable!表示pip找不到cmake。您应该安装它(https://cmake.org/download/)或将它添加到您的路径中。

票数 1
EN

Stack Overflow用户

发布于 2022-02-04 21:33:42

如前所述,问题是没有安装cmake。但是,您可以通过使用Python3.9或3.8完全避免这个问题。pip可以为那些python版本安装预编译的onnx

请参阅https://pypi.org/project/onnx/#files

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70992917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档