pip install torch及对应torchvision、torchaudio

在这个链接中找你需要下的torch版本,会自动帮你匹配好torchvision、torchaudio版本,生成一个pip命令如下:
https://pytorch.org/get-started/previous-versions/

(base) E:\Python\workspace>pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0

在终端Terminal 中输入以上结果后,就自动帮你安装了。如下:

(base) E:\Python\workspace>pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0
Collecting torch==1.8.0
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /packages/fc/d2/c76c193c8ca4307ffa365c40e6ec6f5d1783d8e9310bf6311da91694ac01/torch-1.8.0-cp39-cp39-win_amd64.whl
  Downloading torch-1.8.0-cp39-cp39-win_amd64.whl (190.5 MB)
     ---------------------------------------- 190.5/190.5 MB 8.4 MB/s eta 0:00:00
Collecting torchvision==0.9.0
  Downloading torchvision-0.9.0-cp39-cp39-win_amd64.whl (852 kB)
     ---------------------------------------- 852.5/852.5 kB 7.7 MB/s eta 0:00:00
Collecting torchaudio==0.8.0
  Downloading torchaudio-0.8.0-cp39-none-win_amd64.whl (109 kB)
     ---------------------------------------- 109.0/109.0 kB 1.6 MB/s eta 0:00:00
Requirement already satisfied: numpy in e:\python_2\anaconda3\lib\site-packages (from torch==1.8.0) (1.21.5)
Requirement already satisfied: typing-extensions in e:\python_2\anaconda3\lib\site-packages (from torch==1.8.0) (4.3.0)
Requirement already satisfied: pillow>=4.1.1 in e:\python_2\anaconda3\lib\site-packages (from torchvision==0.9.0) (9.2.0)
Installing collected packages: torch, torchvision, torchaudio
Successfully installed torch-1.8.0 torchaudio-0.8.0 torchvision-0.9.0

你可能感兴趣的:(pip)