You will definitely understand: Installing anaconda3 and changing sources under Windows! (Including the solution to the slow pip speed after changing the source!) Super simple! Super novice!

You must be able to understand the series! From scratch to publishing a paper! From Zero to Hero!

I started writing this series because the relevant domestic learning materials are very messy and uneven. It brought a lot of trouble and trouble during the learning process. A large number of articles contain misinformation. This series of articles will attempt to build the environment and use mainstream deep learning models and frameworks. This series of articles will try to tell you the correct approach directly, avoid making meaningless mistakes, use the most stable method to avoid possible mistakes, and just do the right thing without stepping on mistakes!

This article: Building a deep learning environment under Windows. (Tensorflow)

Based on personal long-term experience and reality, for novices, establishing a deep learning environment under Windows and conducting learning can avoid a lot of peripheral work in the initial stage. There is no need to learn Linux-related parts, and you can focus on machine learning knowledge. Learn and use it to save time and energy to the greatest extent. It is recommended to use the anaconda environment under Windows, which can basically cause no major problems like a nanny. This article will briefly describe how to use anaconda to build a deep learning framework under Windows. Don’t step on thunder! Because anaconda3 includes the anaconda navigator graphical interface, the creation of relevant environments, installation and deletion of software packages under this interface can all be completed here.

Step 1: Install anaconda3:

First download anaconda. It is recommended to use the Tsinghua mirror here. The official anaconda will be very slow due to network reasons:

anaconda | Mirror site usage help | Tsinghua University open source software mirror site | Tsinghua Open Source Mirror

You can click the Data option, select windows-x86_64.exe to download (generally you can choose the latest version), and then follow the hormone routine all the way to next. There are a few key steps to note.

For convenience, select all users

 

Select the installation location, and the virtual environment created later will also be installed to the corresponding path.

Next
, check all the last two items, so that anaconda3 will be added to the environment variable, and you can use the conda command under cmd from now on. (Although in actual situations it is recommended to use the anaconda navigator graphical interface directly to avoid possible bugs. Installation and deletion under anaconda navigator are relatively more stable.)

 After that, just go all the way to finish. (Ignore the optional parts that follow)

Note: At this time, the default source (download channel) after installation is still the official channel of anaconda3. Due to problems with the server overseas, the download speed is extremely slow. We need to change the source (change the download channel to domestic) to speed up.

Step 2: Change the source:

It is recommended to use Tsinghua Source here. The homepage of Tsinghua Source also provides detailed source replacement methods. But the steps are still not detailed enough. As a novice, I couldn't understand it at all, because I had to create and modify a file, which did not exist under Windows at first. So I read a lot of posts and used a lot of commands, but nothing! have! become! achievement! So here is a safe and unmistakable method.

After installing anaconda3, find anaconda navigator in the start menu. Anaconda navigator is the graphical interface of anaconda3. The creation of the environment, the installation and deletion of related software packages can all be completed here. Open the graphical interface of the anaconda environment. (As shown below after opening, the Environment part is the environment part we created, base is the system environment, and the others are the environments we created based on our own needs. Here tens2 and tf2 are the tensorflow environments I created, which were not available at the beginning. , the specific how to create the corresponding environment will be written in the next post.)

 After opening, click Environments. Select base, then click the play button on the right, and click Open Terminal to enter the command line.

 Enter in the terminal

conda config --set show_channel_urls yes,

 After this step, a .condarc file will be created under the folder C drive -> User -> ( your user name ) (under this file we can modify the conda source.), where niuni is my account name. Find the .condarc file and open it with Notepad

 After opening, paste the following content into the file, change it to Tsinghua Source, and save the file changes after modification.

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

After saving, anaconda3 will be modified to Tsinghua source.

The unexpected pit here: 

There is generally no problem following this method, but after my latest source change, I found that the speed of using pip in the terminal was extremely slow. After exploring, I found that I still need to change the pip source. The replacement method is:

Open Terminal and type the following command:

python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

If the replacement speed is too slow, it is recommended to use the following command:

python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

After replacing it there was no problem. (At first I thought it was a problem with my optical-mode modem integrated router, so I bought a new router, which was very tiring)

Guess you like

Origin blog.csdn.net/weixin_49703503/article/details/128360909