Deep learning environment configuration 5 - torch-cpu=1.2.0 environment configuration under windows
Many fans reported that TypeError: array () takes 1 positional argument but 2 were given errors, which can be solved by modifying the pillow version.
pip install pillow==8.2.0
Many people don't have a graphics card and want to configure a deep learning environment. The torch -gpu blog is useless. Get a cpu, so that it can be configured!
The environment configuration blog for the pytorch- gpu version is http://www.ifindbug.com/doc/id-48523/name-deep-learning-environment-configuration-2-torch-1-2-0-environment-configuration-under-windows.html .
The configuration tutorials for each version of pytorch are as follows:
deep learning environment configuration 10 - torch==1.7.1 environment configuration under Ubuntu Deep learning environment configuration 8 - (30 series graphics card) torch==1.7.1 environment configuration depth
Learning environment configuration 5 - torch-cpu=1.2.0 environment configuration
under windows Deep learning environment configuration 2 - torch=1.2.0 environment configuration under windows
1. Anaconda installation
The installation of Anaconda is mainly for the convenience of environment management. You can install multiple environments on one computer at the same time. Different environments place different frameworks: pytorch, tensorflow, and keras can be installed in different environments. You only need to use conda create –n to create a new environment. That's it.
Students can choose to install the new version of Anaconda and the old version of Anaconda, there is no difference in the installation steps.
Download of the old version of anaconda:
The new version of Anaconda does not have VSCODE. If you can install the old version of Anaconda directly for the convenience of installing VSCODE, the Baidu network disk is connected as follows. You can also install the new version and then install VSCODE separately.
Link: https://pan.baidu.com/s/12tW0Oad_Tqn7jNs8RNkvFA Extraction code: i83n
Download of the new version of anaconda:
If you want to install the latest Anaconda, first log in to Anaconda's official website: https://www.anaconda.com/distribution/ . You can directly download the corresponding installation package.
Usually download 64-bit, open after the download is complete.
Select the installation location, you can not install it in the C drive.
I chose Add Anaconda to my PATH environment variable, which will automatically install anaconda into the system's environment variables, and the configuration will be more convenient.
After waiting for the installation, the installation of Anaconda is over.
Win+R to start cmd, enter the following command in the command prompt:
conda create –n pytorch python=3.6
There are two instructions in total:
the previous one is used to create an environment called pytorch, the python version of which is 3.6.
The last instruction is used to activate an environment called pytorch.
Since all our operations must be performed in the corresponding environment, we need to activate the environment before installing the library.
At this point, the cmd window looks like:
Then we enter the following command:
# CPU only pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
This is the official instruction provided by pytorch for installing the cpu version of torch and torchvision.
But if you want to run deep learning models, there are some other dependent libraries that need to be installed. details as follows:
scipy == 1.2 .1 numpy == 1.17 .0 matplotlib == 3.1 .2 opencv_python == 4.1 .2 .30 torch == 1.2 .0 torchvision == 0.4 .0 tqdm == 4.60 .0 Pillow == 8.2 .0 h5py == 2.10.0 _
If you want a more convenient installation, you can create a requirements.txt file on the desktop or elsewhere, and copy the above content into the txt file.
Use the following command to install it. In the following instructions, the path in front of requirements.txt is the path where I put the file on the desktop, and you can modify it according to your computer.
pip install -r C : \ Users\ 33232 \ Desktop\ requirements.txt
It should be noted that if the download and installation in pip is slow, you can change the source. You can go to the user folder, create a pip folder, and then create a txt file in the pip folder.
Modify the content of the txt file and change the suffix to ini
[ global ] index - url = http : //pypi.mirrors.ustc.edu.cn/simple [ install ] use - mirrors = true _ _ _ _ _ _ _ _ _ _ _ mirrors = http : //pypi.mirrors.ustc.edu.cn/simple/trusted-host=pypi.mirrors.ustc.edu.cn _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
After all installation is complete, restart the computer.
3. Install VSCODE
I personally like VSCODE, so I installed it. Other editing software can also be, personal preference.
The latest version of Anaconda does not have VSCODE, so it can be installed directly with Baidu VSCODE.
Directly load the official website of VSCODE https://code.visualstudio.com/ , click Download for Windows to download.
First agree to the agreement, click Next.
Several ticks in the other should be checked, because this way, you can right-click the folder to open it with VSCODE, which is very convenient. Next step.
Proceed to the next step to install.
After the installation is complete, you can change your environment in the lower left corner.
Open anaconda and switch environments.
Install VSCODE, you can launch it after installation, and then you can pin VSCODE to the taskbar for easy opening.
Related: Deep learning environment configuration 5 - torch-cpu=1.2.0 environment configuration under windows
- study foreword
- Configuration tutorial for each version of pytorch
- environmental content
- Environment configuration
- 1. Anaconda installation
- Second, configure the pytorch environment
- 3. Install VSCODE