在 CentOS 上查看 PyTorch 版本,通常有以下几种方式:
python -c "import torch; print(torch.__version__)"
或先进入 Python:
python
>>> import torch
>>> torch.__version__
如果是 Python3:
python3 -c "import torch; print(torch.__version__)"
python -c "import torch; print(torch.__version__, torch.version.cuda)"
pip show torch
或
pip3 show torch
conda list torch
如果你是在 服务器 / 无 GPU / 虚拟环境 下,也可以告诉我,我可以给你更准确的命令。