pip installation plug-in failed solution

Problem: Sometimes installation with pip install xxx (plug-in name, such as: lxml) may fail to install, prompt: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status) appears in the installation package in python =None))…………
Solution:
1. Sometimes the problem is caused by the low pip version, then update pip first and download the installation package again:
python -m pip install --upgrade pip
2. It may be that the network timeout occurs when downloading the external network mirror, and you need to specify the domestic mirror
pip install lxml -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
或
pip install -i http://pypi.douban.com/simple/ lxml

Summary of other sources:

Through several uses of pip, the speed of the default pip source is really unbearable, so some domestic pip sources are collected, as follows:

1. Alibaba Cloud: http://mirrors.aliyun.com/pypi/simple/
2. University of Science and Technology of China: https://pypi.mirrors.ustc.edu.cn/simple/
3. Douban: http://pypi.douban.com/simple/
4. Tsinghua University: https://pypi.tuna.tsinghua.edu.cn/simple/
5. University of Science and Technology of China: http://pypi.mirrors.ustc.edu.cn/simple/

The usage is very simple, just add url directly to -i!
Sometimes when the project is migrated, the virtual environment will fail and need to be reinstalled. If it is your own home computer, you will inevitably encounter the problem of installation failure, and you also need to install by mirroring!

First, you need to export the installation package name of the virtual environment:
pip freeze > requirement.txt

The exported results are as follows:
Insert picture description here

When migrating to a new environment, you can use the following command to install with one click:

pip install -r requirement.txt

But sometimes due to network reasons, if you go back to the external network to download the plug-in by default, you will encounter problems such as timeout and interrupt the plug-in installation:

Insert picture description here

solution:
pip install -r requirement.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

Guess you like

Origin blog.csdn.net/Lin_Hv/article/details/105121157