建立一個叫 huggingface 的 Conda 環境,Python 用 3.12:
conda create -n huggingface python=3.12 -y
建立完成後啟用:
conda activate huggingface
確認目前 Python 路徑
(huggingface) C:\Users\me123>where python
C:\Users\me123\.conda\envs\huggingface\python.exe
C:\Users\me123\AppData\Local\Microsoft\WindowsApps\python.exe
C:\ProgramData\anaconda3\python.exe
C:\ProgramData\anaconda3\envs\yolov8\python.exe

https://pytorch.org/get-started/locally/準備安裝pytorch

> pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu132

安裝完成後
環境執行:
python -c "import torch; print('PyTorch:', torch.__version__); print('CUDA:', torch.version.cuda); print('CUDA available:', torch.cuda.is_available()); print('GPU:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None')"
理想結果應該像:
PyTorch: 2.13.0+cu132 CUDA: 13.2 CUDA available: True GPU: NVIDIA GeForce RTX 5070 Laptop GPU
其中最關鍵的是:
CUDA available: True
如果是 True,代表:
Windows ↓ NVIDIA Driver 596.13 ↓ CUDA 13.2 ↓ PyTorch 2.13.0+cu132 ↓ RTX 5070
已經打通。


請先 登入 以發表留言。