安裝torch
直接使用conda install torch==1.12.0會報錯,因為 Conda 通常使用 pytorch 作為包名(而非 torch)
正確使用方法:
conda install pytorch==1.12.0 -c pytorch
使用 pip 安裝
pip install torch==1.12.0
在 Conda 中查看可安裝的 PyTorch 版本,可以通過以下幾種方法實現:
- 使用 conda search 查詢?
conda search pytorch -c pytorch
- 或指定更多渠道:
conda search pytorch -c pytorch -c conda-forge
# 例如:conda search pytorch -c pytorch -c pytorch
查看已安裝版本
python -c "import torch; print(torch.__version__)"