PyTorch是一個開源的深度學習框架,在Linux系統上的安裝通常是免費的。你可以根據你的系統配置選擇安裝CPU版本或GPU版本。以下是安裝PyTorch的一般步驟:
sudo apt-get update && sudo apt-get upgrade
conda create -n pytorch python=3.8
conda activate pytorch
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip3 install torch torchvision
pip3 install torch torchvision torchaudio -f https://download.pytorch.org/whl/cu113/torch_stable.html
import torch
print(torch.__version__)
通過上述步驟,你應該能夠在Linux系統上成功安裝PyTorch。記得在安裝過程中參考PyTorch的官方文檔,以獲取最新的安裝指南和注意事項。