Anaconda configuration Pytorch

Anaconda installation and configuration will not go into detail, let's install Pytorch. The following is my method


Because I think every kind of different things installed in different virtual environments, would be more comfortable with them, so to create a virtual environment

 

 

 

 Anaconda comes with Navigator, create a virtual environment called "Pytorch" of

 

Then open Anaconda Prompt

 

Enter the command activate Pytorch into the environment Pytorch

You can then install the Pytorch


 

This is the download URL https://pytorch.org/get-started/locally/

Choose according to their actual situation, then the bottom will give the corresponding command downloads

 

 

 

Here with the Pytorch official website to order

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

 

 

 


 

Insert one o'clock digression: the newly created environment, and what is not installed, so you will be prompted to install a lot of packages

In order to download more quickly, we can use a mirror Tsinghua University in Anaconda Navigator, the configuration about Channels, here I added two Channel

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/


 

 

 

You will be prompted: Proceed ([y] / n)? 

Press the y key on the keyboard, enter, will begin to download and install

 

 

 Wait for the installation of ...

 

So when this is out of line, it means that the installation was successful, we have to test

Open Anaconda Navigator, choose Pytorch environment, this time jupyter can see what is not already installed, install the

 

Open Jupyter NoteBook under Pytorch environment

This time may not open, I uninstalled tornado this package, and then reinstall the version 4.5

conda install tornado = 4.5

 然后重新安装了一次Notebook,这次安装的是6.0.1版本,能打的开,但是右上角那里总是提示我正在连接服务

最后升级了ipython和ipythonkernel到最新版本,总算可以打开了,而且可以连接到服务

 

 

jupyter的右上角像这个样子,就正常了 

 

 依次输入三行代码

import torch

torch.__version__

torch.cuda.is_available()

 

 最终结果如上图所示,就算成功了


 

有点麻烦,但是也不算很难哦,总算安装完了,可以继续下去咯~ 

 

Guess you like

Origin www.cnblogs.com/imper/p/11976480.html