File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 3
3
### 根据OS和cuda选择适配的torch版本
4
4
https://pytorch.org/get-started/previous-versions/
5
5
### pip
6
+ #### 安装最新版
6
7
```
7
- 安装最新版
8
8
pip install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple
9
- 指定torch, cuda版本(preffered)
10
- pip install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -i https://pypi.tuna.tsinghua.edu.cn/simple
11
9
```
12
- ### conda
10
+ #### 指定torch, cuda版本(preffered)
11
+ 创建名为pytorch310的虚拟环境
12
+ ```
13
+ conda create -n pytorch310 python==3.10
14
+ ```
15
+ 激活环境
16
+ ```
17
+ conda activate pytorch310
18
+ ```
19
+ 设置清华源,加速安装
20
+ ```
21
+ pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
13
22
```
23
+ 指定版本安装
24
+ ```
25
+ 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
26
+ ```
27
+ ### conda
14
28
添加清华镜像源
29
+ ```
15
30
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
16
31
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
17
32
conda config --set show_channel_urls yes
18
33
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
34
+ ```
19
35
安装并指定cuda版本
36
+ ```
20
37
conda install pytorch torchvision cudatoolkit=10.2
21
38
```
22
39
You can’t perform that action at this time.
0 commit comments