1. anaconda 安装
去官网安装即可。
安装完毕后,我们可以修改 conda 的源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
修改完毕后,查看是否成功修改:
conda config --show channels
2. 显卡驱动
1、卸载原来的显卡驱动
2、官网安装新的显卡驱动
安装完毕后,我们在桌面点击右键可以看到显卡驱动,
3. pytorch_gpu 安装
1、打开anaconda prompt
2、创建虚拟环境
conda create -n pytorch python=3.6
输入下面指令查看是否创建成功,
conda info --envs
如图所示,即创建成功。
3、激活环境
activate pytorch
4、官网安装pytorch
由于服务器在国外,所以下载会很慢。我们可以通过清华源下载,这样下载速度会大大加快,指令修改如下,
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.10.2+cu102 torchvision==0.11.3+cu102 torchaudio===0.10.2+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
下载完毕后,我们可以验证一下,
activate pytorch
python
import torch
print(torch.cuda.is_available())
print(torch.__version__)