In cmd
(base) C:\Users\MIPC\pytorch>set CMAKE_GENERATOR=Visual Studio 16 2019

(base) C:\Users\MIPC\pytorch>set CMAKE_GENERATOR_TOOLSET_VERSION=14.27

(base) C:\Users\MIPC\pytorch>set DISTUTILS_USE_SDK=1

(base) C:\Users\MIPC\pytorch>for /f "usebackq tokens=*" %i in ("%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%
El sistema no puede encontrar el archivo -version.

(base) C:\Users\MIPC\pytorch>set CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\cl.exe

(base) C:\Users\MIPC\pytorch>python setup.py install
Building wheel torch-1.9.0a0+gitbc05867
-- Building version 1.9.0a0+gitbc05867
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Visual Studio 16 2019 -DCMAKE_GENERATOR_TOOLSET_VERSION=14.27 -DCMAKE_INSTALL_PREFIX=C:\Users\MIPC\pytorch\torch -DCMAKE_PREFIX_PATH=C:\Users\MIPC\anaconda3\Lib\site-packages -DNUMPY_INCLUDE_DIR=C:\Users\MIPC\anaconda3\lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Users\MIPC\anaconda3\python.exe -DPYTHON_INCLUDE_DIR=C:\Users\MIPC\anaconda3\include -DPYTHON_LIBRARY=C:\Users\MIPC\anaconda3/libs/python38.lib -DTORCH_BUILD_VERSION=1.9.0a0+gitbc05867 -DUSE_NUMPY=True C:\Users\MIPC\pytorch
CMake Error: Error: generator : Ninja
Does not match the generator used previously: Visual Studio 16 2019
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
Traceback (most recent call last):
  File "setup.py", line 876, in <module>
    build_deps()
  File "setup.py", line 354, in build_deps
    build_caffe2(version=version,
  File "C:\Users\MIPC\pytorch\tools\build_pytorch_libs.py", line 50, in build_caffe2
    cmake.generate(version,
  File "C:\Users\MIPC\pytorch\tools\setup_helpers\cmake.py", line 329, in generate
    self.run(args, env=my_env)
  File "C:\Users\MIPC\pytorch\tools\setup_helpers\cmake.py", line 140, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "C:\Users\MIPC\anaconda3\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '-GNinja', '-DBUILD_PYTHON=True', '-DBUILD_TEST=True', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_GENERATOR=Visual Studio 16 2019', '-DCMAKE_GENERATOR_TOOLSET_VERSION=14.27', '-DCMAKE_INSTALL_PREFIX=C:\\Users\\MIPC\\pytorch\\torch', '-DCMAKE_PREFIX_PATH=C:\\Users\\MIPC\\anaconda3\\Lib\\site-packages', '-DNUMPY_INCLUDE_DIR=C:\\Users\\MIPC\\anaconda3\\lib\\site-packages\\numpy\\core\\include', '-DPYTHON_EXECUTABLE=C:\\Users\\MIPC\\anaconda3\\python.exe', '-DPYTHON_INCLUDE_DIR=C:\\Users\\MIPC\\anaconda3\\include', '-DPYTHON_LIBRARY=C:\\Users\\MIPC\\anaconda3/libs/python38.lib', '-DTORCH_BUILD_VERSION=1.9.0a0+gitbc05867', '-DUSE_NUMPY=True', 'C:\\Users\\MIPC\\pytorch']' returned non-zero exit status 1.

Shouldn’t I touch any parameters?
I think something failed here, however I think that in the end the setup.py didn’t work fine, right?
(base) C:\Users\MIPC\pytorch>for /f "usebackq tokens=*" %i in ("%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%
El sistema no puede encontrar el archivo -version.