【问题标题】:Installation of onnx library fails on Windows 10 using cmd使用 cmd 在 Windows 10 上安装 onnx 库失败
【发布时间】:2020-04-19 15:19:43
【问题描述】:

我尝试使用命令 pip install onnxcmd 中安装 onnx,但我收到一个错误,提示我在 cmake 中遇到问题强>。

错误输出为:

ERROR: Command errored out with exit status 1:
>>command: 'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx'
      cwd: C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\

Complete output (82 lines):
running install
running build
running build_py
running create_version
running cmake_build
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_C_COMPILER:

  cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


  >
-- Configuring incomplete, errors occurred!
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/realm/AppData/Local/Temp/pip-install-oxwi8385/onnx/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 315, in <module>
    setuptools.setup(
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\command\install.py", line 545, in run
    self.run_command('build')
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 209, in run
    self.run_command('cmake_build')
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\realm\AppData\Local\Temp\pip-install-oxwi8385\onnx\setup.py", line 195, in run
    subprocess.check_call(cmake_args)
  File "c:\users\realm\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\realm\\AppData\\Local\\Programs\\Python\\Python38-32\\Scripts\\cmake.exe', '-DPYTHON_INCLUDE_DIR=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\include', '-DPYTHON_EXECUTABLE=c:\\users\\realm\\appdata\\local\\programs\\python\\python38-32\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp38-win32.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.8', '-DONNX_USE_MSVC_STATIC_RUNTIME=ON', '-DONNX_ML=1', 'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 
>>'c:\users\realm\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"'; __file__='"'"'C:\\Users\\realm\\AppData\\Local\\Temp\\pip-install-oxwi8385\\onnx\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\realm\AppData\Local\Temp\pip-record-h01e7u49\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\realm\appdata\local\programs\python\python38-32\Include\onnx' Check the logs for full command output.

【问题讨论】:

    标签: python cmd pycharm onnx


    【解决方案1】:

    我找到了解决方案,原因是我使用 3.8 版本的 python 版本,但是当我将版本更改为 3.7 时它工作了我不知道为什么我发现 onnx 没有 3.8 轮子,这就是它的原因3.8 版不支持

    【讨论】:

      猜你喜欢
      • 2020-04-07
      • 1970-01-01
      • 2017-03-13
      • 2018-05-24
      • 2020-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-20
      相关资源
      最近更新 更多