win10安装pip install torch报错:ERROR: Command errored out with exit status 1: command: ‘D:\anaconda3\

最近要装一个模块,其依赖需要torch,在win10环境下pip install torch,提示:
ERROR: Command errored out with exit status 1: command: 'D:\anaconda3…
win10安装pip install torch报错:ERROR: Command errored out with exit status 1: command: ‘D:\anaconda3\_第1张图片

Collecting torch
  Using cached torch-0.1.2.post2.tar.gz (128 kB)
Requirement already satisfied: pyyaml in d:\anaconda3\lib\site-packages (from torch) (5.3.1)
Building wheels for collected packages: torch
  Building wheel for torch (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-b3_twd4k\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-b3_twd4k\\torch\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-oi1x88w9'
   ...
 Traceback (most recent call last):
      File "", line 1, in <module>
      File "C:\Users\Administrator\AppData\Local\Temp\pip-install-b3_twd4k\torch\setup.py", line 225, in <module>
        setup(name="torch", version="0.1.2.post2",
      File "D:\anaconda3\lib\site-packages\setuptools\__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "D:\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "D:\anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "D:\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Administrator\AppData\Local\Temp\pip-install-b3_twd4k\torch\setup.py", line 99, in run
        self.run_command('build_deps')
      File "D:\anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\Administrator\AppData\Local\Temp\pip-install-b3_twd4k\torch\setup.py", line 51, in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-b3_twd4k\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-b3_twd4k\\torch\\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\Administrator\AppData\Local\Temp\pip-record-ppiar8wl\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\anaconda3\Include\torch' Check the logs for full command output.

  ----------------------------------------
  ERROR: Failed building wheel for torch

在网上找了很多教程,诸如将windows installer切换成自动,都没能解决问题。
最后在pytorch官网地址中,根据自己具体的环境依次选中,然后执行其生成的pip指令,在终端安装即可。
win10安装pip install torch报错:ERROR: Command errored out with exit status 1: command: ‘D:\anaconda3\_第2张图片
win10安装pip install torch报错:ERROR: Command errored out with exit status 1: command: ‘D:\anaconda3\_第3张图片
bingo,安装成功!

你可能感兴趣的:(windows,10,python,pytorch,shell)