可以,CentOS 完全可以运行 PyTorch。
下面给你几个关键点和常见做法:
# 建议使用 Python 3.8+
python3 -m venv pytorch_env
source pytorch_env/bin/activate
pip install torch torchvision torchaudio
如果你没有 GPU,用 CPU 版即可:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
conda create -n torch python=3.9
conda activate torch
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
import torch
print(torch.__version__)
print(torch.cuda.is_available()) # GPU 是否可用
python3glibc,GPU 版 PyTorch 容易报错✅ CentOS 能跑 PyTorch
✅ CPU / GPU 都支持
✅ 生产、服务器、科研都常用
如果你愿意,可以告诉我:
我可以给你一套最合适的安装方案。