Pytorch environment creation

(22 messages) How to install pytorch1.7.1 and torchvision0.8.2 in anaconda, pro-test available_yilia Learning Small Garden-CSDN Blog_torch1.7.1 corresponds to torchvision

​​​​​​Start Locally | PyTorch

​​​​​​https://download.pytorch.org/whl/torch_stable.html

Article directory
1. Create a new environment
2. Get the command to get the package from the pytorch official website
3. Use this command to download the whl package of pytorch
4. Download the numpy package
5. Install the pytorch whl file downloaded in step 3
6. Download torchvision0 .8.2
1. Create a new environment
Open Anaconda Navigator, if you can't find it, enter it in the lower left corner of win10, as shown in the figure below.

Here you can create a new environment through the create button below the list. Here I named the new environment torch. The list on the right is the package I installed. There were not so many when I first created it.


2. Obtain the command to obtain the package from the official website of pytorch.
Open Anaconda Prompt, and enter activate to switch to the newly created environment name. Here I use the following command, you need to modify the corresponding activation name according to the environment name you created.

activate torch
1
Enter the official website of pytorch: https://pytorch.org/get-started/locally/
Select the pip method to load, and get the command shown in the figure below.
There is a point to note here. If the device you want to use later is a GPU instead of a CPU, then you cannot choose None for the CUDA option here, but choose the corresponding version. The next few steps are the same.

Also, why not use conda here? Because after I changed the image to the Tsinghua image, the conda download failed, as shown in the figure below. You can try to use the default image to see if it works, I haven't tried it here.

3. Use this command to download the whl package of pytorch
Here I directly pasted the above command from the official website into Anaconda Prompt, but half of the download went wrong. You don’t need to wait for it to be downloaded here, you can directly copy and paste it to the browser to download after the link circled in the yellow box in the picture below appears, the speed is super fast! Everyone remember to avoid my mine!

In this way, we downloaded the following whl file.


4. Download the numpy package
Use the following command to download the numpy package. After my own test, this step is necessary, otherwise an error will be reported when proceeding to the next step!
This step of downloading went very smoothly, no error was reported, so I won’t take a screenshot here because it’s a bit long.

conda install numpy
1
5. Install the pytorch whl file downloaded in step 3.
Use the pip install local path command to load the torch package, as shown in the figure, the process is very smooth.
Next, you can use the conda list command to view the package, and you can see that the torch package has been successfully downloaded.


6. Download torchvision0.8.2
Use the same method to officially download the whl package of torchvision, and then pip install the package, which can be successfully installed.
Official website address: https://download.pytorch.org/whl/torch_stable.html
Note:
1. Select the torchvision package corresponding to the python version and pytorch version, otherwise it cannot be installed successfully.
2. Before installing torchvision, make sure that pillow has been installed. If not, use the same method to download the pillow package from the official website and install it, then install torchvision.
Official website address: https://www.wheelodex.org/projects/pillow/

Share a website where you can find almost all python packages, download the corresponding packages from this website, pip installation is very convenient
https://www.lfd.uci.edu/~gohlke/pythonlibs/
————————————— ————
Copyright statement: This article is an original article of CSDN blogger "Boubao with stuffing exposed", following the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/weixin_36465540/article/details/111242733

Guess you like

Origin blog.csdn.net/m0_54111890/article/details/121870027