点安装和自定义索引网址 [英] pip install and custom index url

查看:121
本文介绍了点安装和自定义索引网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用pip安装时出现以下异常:

I am getting the following exception while trying to install using pip:

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(111, 'Connection refused'))': /simple/<package>/

pip从哪里安装软件包?

如何代理或使用备用内部站点来获取这些软件包?

How do I proxy or use alternate internal site to get these packages?

推荐答案

pip install查看http://pypi.python.org/simple/<package>/

如果无法打开与pypi.python.org的连接以访问(例如,由于您的防火墙规则),您可能会看到以下错误.

You might see the following error in case the connection to pypi.python.org is not open to access (e.g. because of your firewall rules).

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(111, 'Connection refused'))': /simple/<package>/

-v选项(启用调试日志记录/详细模式是开始调试的好方法).

The -v option (enabling debug logging/verbose mode is a nice way to start debugging).

通常公司会为 http://pypi.python.org/simple 创建代理.内部站点可以在不访问互联网的情况下访问它.

Often companies create a proxy to http://pypi.python.org/simple so all the internal sites can access it when they are not exposed to internet.

我们可以在pip.conf中配置此URL.默认情况下,pip会在$HOME/.pip/pip.conf中查找配置数据.

We can configure this url in pip.conf. By default pip looks into $HOME/.pip/pip.conf for configuration data.

[global]
extra-index-url = https://my-pypi.mywebsite.com/simple
timeout = 10

如果已设置conf,但仍未选择pip conf,请检查pip.conf是否在用户的正确主目录中.

If you have set the conf and yet if the pip conf is not being picked check that pip.conf is in the right home directory for the user.

例如 /root,/或/home/user

e.g. /root, / or /home/user

这篇关于点安装和自定义索引网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆