Skip to content

Commit fd9e149

Browse files
authored
Update pytorch.md
1 parent 23c8a12 commit fd9e149

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ai/pytorch.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,40 @@
44
https://pytorch.org/get-started/previous-versions/
55
### pip
66
#### 安装最新版
7-
```
7+
```shell
88
pip install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple
99
```
1010
#### 指定版本(preffered)
1111
创建名为pytorch310的虚拟环境
12-
```
12+
```shell
1313
conda create -n pytorch310 python==3.10
1414
```
1515
激活环境
16-
```
16+
```shell
1717
conda activate pytorch310
1818
```
1919
设置清华源,加速安装
20-
```
20+
```shell
2121
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
2222
```
2323
指定版本安装
24-
```
24+
```shell
2525
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
2626
```
2727
### conda
2828
添加清华镜像源
29-
```
29+
```shell
3030
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
3131
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
3232
conda config --set show_channel_urls yes
3333
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
3434
```
3535
#### 安装最新版
36-
```
36+
```shell
3737
conda install pytorch torchvision torchaudio cudatoolkit=10.2
3838
```
3939
#### 指定版本
40-
```
40+
```shell
4141
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4 cudatoolkit=10.2
4242
```
4343

0 commit comments

Comments
 (0)