Anaconda how to install PyTorch?

Anaconda installation under PyTorch into online installation and on-line installation.

Online installation:

Anaconda default here is already installed, open the Prompt Anaconda.

But before installation it should be noted that, the online network for installation requirements more stringent, be sure to use a wired network, improve the stability of the installation process , do not use the wireless network may be a variety of problems.

1. Set up a virtual environment. The reason to set up a virtual environment, because the python inside the bag there are many, some packages can be problematic interfere with each other, so use the virtual environment to isolate them.

     Create a virtual environment: conda create -n torch python = 3.6

     Activate the virtual environment: activate torch,

     It can be seen when the torch is activated environment, environment on the left side of the base becomes a torch.

2. go Pytorch official website ( https://pytorch.org/get-started/locally/ find this command PyTorch installation requires the use of lower).

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

The above command line code adhered to inside,

After that began the long wait, the faster the speed, the shorter the time needed. If science can access to the Internet, then it is better and better.

Now you can see, is now installed, we enter the python environment, and then enter the import torch and import torchvision verification, if there is no error, then, then the installation is successful.

 

 

How to install a lower version of pytorch?

conda install pytorch=1.0 torchvision cudatoolkit=10.1 -c pytorch

But it is possible to encounter situations that can not be downloaded.

 

 

 

 

Stepped pit:

1. When encountered during installation progress bar does not go, the point of the Enter key

    就像下图这样,这个包的安装就会停止,从而转向下一个包的安装。但是这样这个pytorch是没有安装上的,等到在python下面import torch的时候,还是会报错。

    解决办法,重新使用这个conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

再安装一次就可以了。

2.

发布了41 篇原创文章 · 获赞 9 · 访问量 1万+

Guess you like

Origin blog.csdn.net/u014723479/article/details/103001861