找不到文件错误 Ray 安装 Windows

File not found error Ray installation Windows

我正在尝试在 Windows 上使用 Ray,并且已经安装了 documentation, but am unable to initialize Ray even though the latest Visual C++ runtime

每当我运行

import ray
ray.init()

我收到以下错误

  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\ray\worker.py", line 694, in init
    _global_node = ray.node.Node(
  File "C:\Python38\lib\site-packages\ray\node.py", line 198, in __init__
    self.start_head_processes()
  File "C:\Python38\lib\site-packages\ray\node.py", line 800, in start_head_processes
    self.start_redis()
  File "C:\Python38\lib\site-packages\ray\node.py", line 571, in start_redis
    self.get_resource_spec(),
  File "C:\Python38\lib\site-packages\ray\node.py", line 287, in get_resource_spec
    self._resource_spec = ResourceSpec(
  File "C:\Python38\lib\site-packages\ray\resource_spec.py", line 167, in resolve
    num_gpus = _autodetect_num_gpus()
  File "C:\Python38\lib\site-packages\ray\resource_spec.py", line 278, in _autodetect_num_gpus
    lines = subprocess.check_output(cmdargs).splitlines()[1:]
  File "C:\Python38\lib\subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Python38\lib\subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

我已经尝试安装两个 x86: vc_redist.x86.exe and x64: vc_redist.x64.exe,但没有骰子。我什至重新安装了 Visual Studio 2019,希望它能解决问题。
我该如何解决这个错误?

C:\Windows\System32\wbem 放入您的 PATH 环境变量中。 _autodetect_num_gpus 无法 运行 wmic.exe 位于该文件夹中。