在Linux系统上选择PyTorch版本时,需要考虑以下几个因素:
确保你的Linux发行版(如Ubuntu、Deepin等)受PyTorch支持。推荐使用Python 3.6及以上版本。
conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
pip install torch torchvision torchaudio
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
import torch
print(torch.__version__)
print(torch.cuda.is_available())
如果输出为True,则表示CUDA可用。
为了加快下载速度,可以使用国内的镜像源,如清华大学的镜像源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
通过以上步骤,你应该能够在Linux系统上成功安装并选择合适的PyTorch版本。如果在安装过程中遇到任何问题,建议参考PyTorch的官方文档或社区资源,以获取更全面和详细的指导。