在带有 CNTLM 的代理后面使用 pip [英] Using pip behind a proxy with CNTLM

查看:20
本文介绍了在带有 CNTLM 的代理后面使用 pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在工作中的代理后面使用 pip.

I am trying to use pip behind a proxy at work.

这篇文章的答案之一 建议使用 CNTLM.我按照这篇另一篇文章安装并配置了它,但是运行 cntlm.exe -c cntlm.ini -I -M http://google.com 给出了错误 代理连接失败,退出.

One of the answers from this post suggested using CNTLM. I installed and configured it per this other post, but running cntlm.exe -c cntlm.ini -I -M http://google.com gave the error Connection to proxy failed, bailing out.

我也试过 pip install --proxy=user:pass@localhost:3128(默认的 CNTLM 端口)但是引发了 Cannot fetch index base URL http://pypi.python.org/简单/.很明显,代理出了点问题.

I also tried pip install -–proxy=user:pass@localhost:3128 (the default CNTLM port) but that raised Cannot fetch index base URL http://pypi.python.org/simple/. Clearly something's up with the proxy.

有谁知道如何更明确地检查 CNTLM 是否设置正确,或者是否还有其他方法可以解决这个问题?我知道您还可以按照 此处 但我不确定要放入哪些凭据.cntlm.ini 中的凭据?

Does anyone know how to check more definitively whether CNTLM is set up right, or if there's another way around this altogether? I know you can also set the http_proxy environment variable as described here but I'm not sure what credentials to put in. The ones from cntlm.ini?

推荐答案

要为 Windows 设置 CNTLM,请按照此 文章.对于 Ubuntu,请阅读我的博文.

To setup CNTLM for windows, follow this article. For Ubuntu, read my blog post.

基本上,要在任何平台上使用 CNTLM,在使用 http://127.0.0.1:3128 作为代理之前,您需要设置您的用户名和 哈希 密码到您的父代理.

Basically, to use CNTLM in any platform, you need to setup your username and hashed password, before using http://127.0.0.1:3128 as a proxy to your parent proxy.

  1. 编辑配置并添加重要信息,如域、用户名、密码和父代理.

  1. Edit the config and add important information like domain, username, password and parent proxy.

生成散列密码.

Windows cntlm –c cntlm.ini –H

Ubuntu/Linux cntlm -v -H -c/etc/cntlm.conf

从配置中删除纯文本密码并将其替换为生成的密码.

Remove plain text password from the config and replace them with the generated passwords.

检查是否工作:

Windows cntlm –M http://www.google.com

Ubuntu/Linux sudo cntlm -M http://www.google.com/

有关更详细的说明,请参阅上面的链接.

For more detailed instructions, see links above.

更新:

为了完整起见,我最近能够在 Windows 中配置和使用 CNTLM.我在 PC 版 Kindle 同步过程中遇到了一个问题,因为我们的代理和安装和配置 CNTLM for Windows 为我解决了这个问题.有关详细信息,请参阅我的文章.

Just for completeness sake, I was able to configure and use CNTLM in Windows recently. I encountered a problem during the syncing process of Kindle for PC because of our proxy and installing and configuring CNTLM for Windows fixed that issue for me. Refer to my article for more details.

这篇关于在带有 CNTLM 的代理后面使用 pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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