Install packages using proxy server and pip

When the proxy server is turned on, the following error will appear when pip install the package name directly:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /simple/tensorboard/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /simple/tensorboard/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /simple/tensorboard/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /simple/tensorboard/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /simple/tensorboard/
Could not fetch URL https://pypi.org/simple/tensorboard/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tensorboard/ (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))) - skipping
ERROR: Could not find a version that satisfies the requirement tensorboard (from versions: none)
ERROR: No matching distribution found for tensorboard

If you turn off the proxy server and then install it, it will be more troublesome to reopen the proxy server after the installation is completed. At this time, you can use the --proxy option in pip to install relevant software packages using pip while connecting to the proxy server. The specific operations are as follows:

pip install --proxy http://proxy.server:port package_name
## example
pip install --proxy http://126.1.1.1:22 numpy

Among them, proxy.server and port are the address and port number of your proxy server.

If your proxy server requires a username and password, then,

pip install --proxy http://user:[email protected]:port package_name

 Among them, user and password are the username and password of your proxy server

Guess you like

Origin blog.csdn.net/qq_38964360/article/details/132629683