在CNTLM的代理后面使用pip [英] Using pip behind a proxy with CNTLM
问题描述
我正在尝试在工作中使用代理后面的点子.
I am trying to use pip behind a proxy at work.
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/simple/
.显然,代理出现了问题.
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是否设置正确,或者是否还有其他方法可以完全解决这一问题?我知道您还可以按照
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,请遵循以下我的博客文章 .
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.
-
编辑配置并添加重要信息,例如域,用户名,密码和父代理.
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.在Kindle for PC的同步过程中,由于我们的代理以及为Windows安装和配置CNTLM的问题,我遇到了一个问题,此问题已为我解决.有关更多详细信息,请参见我的文章.
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屋!