PyTorch를 설치할 수 없습니다. - 오류: 종료 상태 1로 인해 명령 오류가 발생했습니다.

PyTorch를 설치할 수 없습니다. - 오류: 종료 상태 1로 인해 명령 오류가 발생했습니다.

저는 Python 아연 베이스로 작업하려고 하는데 이를 위해서는 Windows에 pytorch를 설치해야 합니다. 실행시

pip install torch

다음과 같은 오류가 발생합니다.

ERROR: Command errored out with exit status 1:
command: 'c:\data-nobackup\development\im-099329- 
gremlintest\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\torch\\setup.py'"'"'; __file__='"'"'C:\\Users\\104172\\AppData\\Local\\Temp\\pip-install-5go0i_r_\\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\104172\AppData\Local\Temp\pip-wheel-bk0m_2ck' --python-tag cp36
   cwd: C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\
  Complete output (30 lines):
  running bdist_wheel
  running build
  running build_deps
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 265, in <module>
  description="Tensors and Dynamic neural networks in Python with strong GPU acceleration",
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\setuptools\__init__.py", line 145, in setup
  return distutils.core.setup(**attrs)
File "c:\customsoftware\python3.6\Lib\distutils\core.py", line 148, in setup
  dist.run_commands()
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 955, in run_commands
  self.run_command(cmd)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "c:\data-nobackup\development\im-099329-gremlintest\env\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
  self.run_command('build')
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
  self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "c:\customsoftware\python3.6\Lib\distutils\command\build.py", line 135, in run
  self.run_command(cmd_name)
File "c:\customsoftware\python3.6\Lib\distutils\cmd.py", line 313, in run_command
  self.distribution.run_command(command)
File "c:\customsoftware\python3.6\Lib\distutils\dist.py", line 974, in run_command
  cmd_obj.run()
File "C:\Users\104172\AppData\Local\Temp\pip-install-5go0i_r_\torch\setup.py", line 51, in run
  from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'

  ERROR: Failed building wheel for torch

파이토치를 어떻게 설치하나요?

답변1

PyTorch 웹사이트를 방문하면 됩니다.pytorch.org

그런 다음 '시작하기' 페이지로 이동하세요. 다양한 옵션을 선택할 수 있고 "torch"를 설치하기 위한 적절한 명령을 제공하는 흥미로운 온라인 도구를 볼 수 있습니다.

다음 그림과 같습니다.

여기에 이미지 설명을 입력하세요

위의 선택 항목에서 볼 수 있듯이 토치 설치를 위한 다음 명령이 결과로 나타납니다.

pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

답변2

다른 라이브러리와 달리 pip install torch 명령을 사용하여 PyTorch를 로컬로 설치할 수는 없습니다.

이동https://pytorch.org웹 사이트를 방문하고 컴퓨터와 환경을 선택하면 다음과 같이 실행할 명령이 제공됩니다.

pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

파이썬 3.7의 경우 -

pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl pip3 install torchvision

관련 정보