PIP failed to install the package

Collecting grpcio = = 1.34.0 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6f7311e310>: Failed to establish a new connection: [Errno 101] Network is unreachable')': 45 / dd/f87383954f1d9940db899eb69c72350c1065a4331b397f7da62f221867f2 / / packages/grpcio 1.34.0 - cp38 cp38 -- manylinux2014_x86_6 4.whl WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6f7311e460>: Failed to establish a new connection: [Errno 101] Network is unreachable')': 45 / dd/f87383954f1d9940db899eb69c72350c1065a4331b397f7da62f221867f2 / / packages/grpcio 1.34.0 - cp38 cp38 -- manylinux2014_x86_6 4.whl WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6f7311e5b0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': 45 / dd/f87383954f1d9940db899eb69c72350c1065a4331b397f7da62f221867f2 / / packages/grpcio 1.34.0 - cp38 cp38 -- manylinux2014_x86_6 4.whlCopy the code

In this case, you can solve the problem in the following two ways:

  1. For a single package
pip3 install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn
Copy the code
  1. Global changes
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
Copy the code

The first method can be used for a single package installation. The second method is used for entire projects or global modifications.