subprocess.CalledProcessError: Command ‘[‘where‘, ‘cl‘]‘ returned non-zero exit status 1.

Posted AI浩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了subprocess.CalledProcessError: Command ‘[‘where‘, ‘cl‘]‘ returned non-zero exit status 1.相关的知识,希望对你有一定的参考价值。

文章目录

问题

subprocess.CalledProcessError: Command ‘[‘where’, ‘cl’]’ returned non-zero exit status 1.
更详细的错误如下:

(base) PS D:\\TrackAndReID\\Total3DUnderstanding-master> python main.py configs/total3d.yaml --mode demo --demo_path demo/inputs/1
D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py:346: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
  warnings.warn(f'Error checking compiler version for compiler: error')
信息: 用提供的模式无法找到文件。
Traceback (most recent call last):
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\main.py", line 21, in <module>
    from net_utils.utils import initiate_environment
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\net_utils\\utils.py", line 12, in <module>
    from models.registers import METHODS
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\models\\__init__.py", line 1, in <module>
    from . import total3d, mgnet
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\models\\mgnet\\__init__.py", line 1, in <module>
    from . import modules, training, config, dataloader
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\models\\mgnet\\config.py", line 5, in <module>
    from .testing import Tester
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\models\\mgnet\\testing.py", line 8, in <module>
    from external.pyTorchChamferDistance.chamfer_distance import ChamferDistance
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\external\\pyTorchChamferDistance\\chamfer_distance\\__init__.py", line 1, in <module>
    from .chamfer_distance import ChamferDistance
  File "D:\\TrackAndReID\\Total3DUnderstanding-master\\external\\pyTorchChamferDistance\\chamfer_distance\\chamfer_distance.py", line 5, in <module>
    cd = load(name="build",
  File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py", line 1202, in load
    return _jit_compile(
  File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py", line 1425, in _jit_compile
    _write_ninja_file_and_build_library(
  File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py", line 1524, in _write_ninja_file_and_build_library
    _write_ninja_file_to_build_library(
  File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py", line 1963, in _write_ninja_file_to_build_library
    _write_ninja_file(
  File "D:\\Users\\wh109\\anaconda3\\lib\\site-packages\\torch\\utils\\cpp_extension.py", line 2090, in _write_ninja_file
    cl_paths = subprocess.check_output(['where',
  File "D:\\Users\\wh109\\anaconda3\\lib\\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "D:\\Users\\wh109\\anaconda3\\lib\\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

解决方法

安装VS2017
然后将

C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\Hostx64\\x64

添加到系统变量

以上是关于subprocess.CalledProcessError: Command ‘[‘where‘, ‘cl‘]‘ returned non-zero exit status 1.的主要内容,如果未能解决你的问题,请参考以下文章