PIP 从本地文件夹进行安装时阻止连接到 pypi.python.org

PIP Prevent connection to pypi.python.org while doing installation from local folder

尝试通过 PIP 进行安装,如下所示

sudo pip install --verbose -U --allow-unverified --no-index --find-links=/tmp/chef-cache/patroni patroni[zookeeper]==1.4.4

我看到 pip 正在尝试连接到 pypi.python.org

Getting page https://pypi.python.org/simple/patroni/
Starting new HTTPS connection (1): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (2): pypi.python.org
Incremented Retry for (url='/simple/patroni/'): Retry(total=3, connect=None, read=None, redirect=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(99, 'Cannot assign requested address'))': /simple/patroni/
Starting new HTTPS connection (3): pypi.python.org

该设置无法访问外部 IP。有什么方法可以阻止 pip 尝试连接到 pypi.python.org 吗?

注意 - 安装进行得很好。但它会花费更多时间,因为它会尝试连接到 pypi.python.org 然后超时,从而减慢安装速度。

这看起来像是 PIP 7.1.2 的问题。在最新的 PIP 18.0 中没有观察到该问题。