清华镜像源导入torch
时间: 2024-05-10 08:12:36 浏览: 93
《PyTorch中文手册》学习之路day1-pytorch简介和环境搭建
5星 · 资源好评率100%
你可以通过以下步骤导入清华镜像源:
1. 打开终端,输入以下命令切换到root用户:
```
sudo su
```
2. 输入以下命令备份原有的源列表文件:
```
cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
3. 输入以下命令编辑源列表文件:
```
nano /etc/apt/sources.list
```
4. 将以下内容复制到源列表文件中:
```
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
```
5. 保存并退出文件编辑器,输入以下命令更新软件源:
```
apt-get update
```
6. 输入以下命令安装torch:
```
pip install torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple/
```
阅读全文