2020年12月10日 星期四

Windows 安裝 PyTorch

為了上課方便, 今天在辦公室電腦重新安裝 Python 資料科學與機器學習套件 (目前是 Python 3.8.5), 其中 PyTorch 的安裝指令可以到其官網選擇安裝環境, 底下就會出現指令了 :





例如我選 Windows 穩定版本的 pip 安裝指令為 :

pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

E:\python>pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html  
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch===1.7.0
  Downloading https://download.pytorch.org/whl/cu102/torch-1.7.0-cp38-cp38-win_amd64.whl (1282.4 MB) bytes/s
Requirement already satisfied: numpy in c:\python38\lib\site-packages (from torch===1.7.0) (1.18.5)
Collecting torchaudio===0.7.0
  Downloading https://download.pytorch.org/whl/torchaudio-0.7.0-cp38-none-win_amd64.whl (103 kB)
Collecting torchvision===0.8.1
  Downloading https://download.pytorch.org/whl/cu102/torchvision-0.8.1-cp38-cp38-win_amd64.whl (1.5 MB)
Requirement already satisfied: numpy in c:\python38\lib\site-packages (from torch===1.7.0) (1.18.5)
Requirement already satisfied: pillow>=4.1.1 in c:\python38\lib\site-packages (from torchvision===0.8.1) (8.0.1)
Collecting dataclasses
  Downloading dataclasses-0.6-py3-none-any.whl (14 kB)
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
Collecting typing-extensions
  Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Building wheels for collected packages: future
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491058 sha256=cf5e6afd4c615aa6d3efb2830fcb77bd371d106f80e6bcdee9062669ec328e31
  Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\8e\70\28\3d6ccd6e315f65f245da085482a2e1c7d14b90b30f239e2cf4
Successfully built future
Installing collected packages: typing-extensions, future, dataclasses, torch, torchvision, torchaudio
Successfully installed dataclasses-0.6 future-0.18.2 torch-1.7.0 torchaudio-0.7.0 torchvision-0.8.1 typing-extensions-3.7.4.3

可見 PyTorch 還蠻大的, 接近 1.3GB.

另外我在安裝 TensorFlow (v2.3.1, 約 342MB) 時發現它會把原先安裝的最新 Numpy 1.19.4 刪除, 改安裝 Numpy 1.18.5. 


沒有留言 :