The most detailed installation and configuration of PyTorch entry deep learning environment under Windows (GPU version)
1. Anaconda installation and virtual environment creation
1. Download Anaconda
Anaconda official website: https://www.anaconda.com
Tsinghua University open source mirror download: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
Both websites can be downloaded, choose the version suitable for your computer to download That's it.
2. Install Anaconda
Choose to add to the environment variable
and the installation is successful
3. Create a virtual environment
conda create -n 虚拟环境名字 python=版本
conda activate 虚拟环境名字
If you want to delete the virtual environment, enter in the command line window:
conda remove -n 虚拟环境名字 --all
2. Computer configuration, GPU and CUDA preparations
1. Check the computer GPU model and determine the GPU computing power
My graphics card model:
2. Determine the CUDA version according to the computing power
My graphics card computing power corresponds to 6.1
(1) Determine your optional CUDA Runtime Version
(2) Make sure your CUDA Drive version >= CUDA Runtime version.
You can check and find that 9.0 or above is available
(3) Query your own driver CUDA Drive Version
Enter in the anaconda command linenvidia-smi
Mine is 12.1
(4) sure we can apply CUDA
9-12.0
3. You can update the graphics card driver before the first two steps
3. Install Pytorch
1. CUDA version selection
CUDA select the latest 11.7
to copy the installation command (copy Run this Command)
to activate the virtual environment to be installed (conda activate virtual environment name)
and paste the installation command, just wait for a while
2. Verify Pytorch
Activate the virtual environment corresponding to the installation of Pytorch
Enter conda list to see if there is pytorch or torch in the list
Enter python
, enter import torch,
enter torch.cuda.is_available(),
if it displays True, it means that Pytorch is installed successfully
Fourth, install PyCharm and configure it
1. Select the community version
Refer to online installation
2. Connect to the virtual environment created by anaconda
Click New Project, and the New Project
project path can be changed.
Use the virtual environment created by anaconda
After Anaconda configures the virtual environment, you need to add the environment to PyCharm. (Or when creating a new project, set the operating environment for a certain project), choose Conda Environment, sometimes Conda executable is not found error Conda
executable, be sure to choose Conda.exe instead of python.exe, so we have to choose to download in _Conda.exe in the Anaconda root directory, which is the bottom of the picture below (note: the file name is underlined)
Next, because we have created a virtual environment in Anaconda, click Use existing environment and select the installed Anaconda The virtual environment is enough, click OK in the lower right corner, you can
return to the project creation page, click Create, you
can see the virtual environment in the lower right corner,
you're done
5. References
https://blog.csdn.net/qq_43874102/article/details/123164105
https://blog.csdn.net/s1hjf/article/details/128759758
https://blog.csdn.net/s1hjf/article/details/128756004
https://www.bilibili.com/video/BV1S5411X7FY