在Ubuntu系统上配置PyTorch环境,你可以按照以下步骤进行:
.sh
文件)。bash Anaconda3-xxxx.xx-Linux-x86_64.sh
pytorch_env
的新环境,并指定Python版本(例如3.8):conda create -n pytorch_env python=3.8
conda activate pytorch_env
conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch
conda install pytorch torchvision torchaudio cpuonly -c pytorch
import torch
print(torch.__version__)
pip install --upgrade pip
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
pip install torch torchvision torchaudio
import torch
print(torch.__version__)
gcc
、make
等。通过以上步骤,你应该能够在Ubuntu系统上成功配置PyTorch环境。