PyTorch는 컴퓨터비전, 자연어처리 등에 활용되는 오픈소스 머신러닝 프레임워크이다.
1. Anaconda, Python 버전 확인
Anaconda Powershell Prompt에서 버전을 확인한다.
2. PyTorch 사이트 접속
Run this Command : 에 나온 명령어를 Anaconda Powershell Prompt에서 실행시킨다.
conda install pytorch torchvision torchaudio cpuonly -c pytorch
설치가 진행된다.
3. 확인하기
Anaconda Powershell Prompt에서 python 명령을 실행한다.
python
다음 코드를 입력한다.
import torch
x = torch.rand(2, 3)
print(x)
출력은 임의의 2x3 텐서이다. 출력은 다음과 유사하게 나온다.
⚠️ RemoveError
설치 도중 RemoveError: 'setuptools' is a dependency of conda and cannot be removed from
conda's operating environment. 라는 에러가 발생했다.
아래의 코드를 프롬프트에 입력해 아나콘다를 강제적으로 업데이트한다.
conda update --force conda
이후 다시 명령어를 실행하니 설치가 되었다.
참고사이트
https://docs.microsoft.com/ko-kr/windows/ai/windows-ml/tutorials/pytorch-analysis-installation
https://newindow.tistory.com/111