The reason for modifying the mirror source is that pip and conda default to foreign mirror sources, so every time you install a module pip install ××× or conda install ××× it's very slow.
So, switching to a domestic mirror source will significantly speed up module installation.
The way that pip and conda modify the image source is different, and there are tons of tutorials on the web, which I've summarized together.
pip modifies the mirror source
Domestic sources:
The new version of ubuntu requires an https source, be aware of that.
Tsinghua:/simple
Aliyun: /pypi/simple/
University of Science and Technology of China /simple/
Huazhong University of Science and Technology: /
Shandong University of Technology:/
Douban: /simple/
Tsinghua's mirror source is the most commonly used, and after I tried several mirror sources, I found that CSU's is faster and of good quality.
1. for Linux systems:
mkdir ~/.pip cd ~/.pip vi
Press i to enter edit mode:
[global] index-url = /simple/
Press ESC, then type wq to save.
2. For windows system:
cd C:\Users\(Your username) mkdir pip cd pip cd.>
Then open C:\Users(username)\pip\ and paste the same content as linux system in there:
[global] index-url = /simple/
When installing with pip, I found that the mirror source link changed and it worked~
#Conda modifies the mirror source
Linux and Windows have the same approach to modifying the image source for conda:
conda config --add channels /anaconda/pkgs/free/ conda config --set show_channel_urls yes
Check to see if the channel has been added for use:
vim ~/.condarc
It's right to see this:
Then, try installing a module:
conda install Try any module, see the link change to Tsinghua, that's right~
Addendum: Modifying anaconda and pip sources
Modify pip source
Create a new .pip/ in the user directory and enter
[global] index-url = /simple/
Modifying the anaconda source
Directly under terminal, type
conda config --add channels /anaconda/pkgs/free/ conda config --set show_channel_urls yes
The above is a personal experience, I hope it can give you a reference, and I hope you can support me more. If there is any mistake or something that has not been fully considered, please do not hesitate to give me advice.