When using Python, you need to use a variety of libraries, usually using pip to install directly, which is the simplest and most convenient. But the biggest crash is that sometimes the speed is surprisingly slow, because the source used by pip by default is the official source, and the official source is abroad. The usual solution is to replace the source. Common domestic sources are as follows:
https://pypi.tuna.tsinghua.edu.cn/simple/ Tsinghua
http://pypi.doubanio.com/simple/ Douban
http://mirrors.aliyun.com/pypi/simple/ Ali
https://pypi.mirrors.ustc.edu.cn/simple/ University of Science and Technology of China
http://mirrors.163.com/pypi/simple/ NetEase
Permanently replace the source under Windows
The text content is as follows:
[ global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
Permanently replace the source under Linux
mkdir -p ~/.pip
vim ~/.pip/pip.conf
[ global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
Temporarily change the pip source
pip install <package name-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
The above is the whole content of this article, I hope it will be helpful to everyone's study.
Recommended Posts