pytorch 설치(CUDA버전 포함)

2025.04.15 17:00 260 Views

Pytorch 처음 설치할 때 매번 검색하기에 번거로울 수 있으니 공유합니다.


1️⃣ PyTorch (CPU 버전 설치)

pip install torch torchvision torchaudio



2️⃣ PyTorch (CUDA 버전 설치)

※ CUDA 버전은 사용하는 GPU 환경에 따라 맞춰 설치해야 합니다.

  • CUDA 11.8 기준:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118


  • CUDA 11.7 기준:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117


버전 모르면 nvidia-smi로 확인한번 해보세요~

3️⃣ 설치 확인

python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"


pytorch 한번 꼬이면 지웠다가 다시까시는 걸 추천합니다.

그게 제일 빠르더라구요 ㅎ