Lai Yonghao (http://laiyonghao.com)
Keywords: Python, easy_install, setuptools, bitvise tunnelier, polipo, windows, Linux, SOCKS5, HTTP, proxy
Some of our websites cannot be accessed here. One of the biggest impacts on me is that easy_install cannot access the website when installing some Python modules. Here we will share with you how to allow easy_install to use proxy. If you have a SOCKS5 or HTTP Proxy server available, this method can perfectly bridge the great wall of easy_install.
HTTP
First, we will introduce the easy-to-implement HTTP method. Because the python module urllib can use proxy transparently, easy_install uses HTTP proxy in a very convenient way. In both Windows and Linux, you only need to set the http_proxy environment variable.
You can run the following command in Windows:
Set http_proxy = http://your.proxy.com: yourport
Or run the following command in Linux:
Export http_proxy = "http://your.proxy.com: yourport"
Then execute easy_install.
SOCKS5
If you have VPs, we recommend using bitvise tunnelier in windows, which can use your VPS to provide the SOCKS5 proxy service. Unfortunately, easy_install cannot directly use the SOCKS5 proxy, so a software is required to convert the SOCKS5 proxy to the HTTP proxy. I chose the software polipo to create an HTTP Proxy Based on the comments from many friendly people on Twitter.
Polipo is very simple to use, here (http://interloper.org/tmp/polipo/polipo-1.0.4.1-forbidden-1-win32.exe) download to a Windows Installation File, one way to install next, after installation to enter the installation directory of polipo.exe, open the config file in notepad or another Editor (I use gvim) and find the following two lines:
# Socksparentproxy = "localhost: 9050" # socksproxytype = SOCKS5
Then remove # from the front and change 9050 to the port of your SOCKS5 server. I use the default 1080 of bitvise tunnelier, and then save and close it.
Now you can run polipo through the Start menu. You can see the words "established listening socket on port 8123", indicating that the operation is successful. Then, use the preceding method to set http: // 127.0.0.1: 8123 to the http_proxy environment variable. Your easy_install will be able to use the proxy.
Other solutions
In free Linux, polipo is a cross-platform software. You can also use the tscoks and proxychains recommended by @ number5, @ kynix, and @ kypudding, you can also use sockscap in windows. The polipo solution I use comes from @ boypt's recommendation. Thanks to everyone and the country for giving me motivation and opportunities to learn about these tools, I believe that these technologies will be used elsewhere ". This solution benefits from two great websites, Google and Twitter.
Postscript
This was originally published in Ben Bo in April 16, 2010.ArticleBecause the previous versions have too many sensitive... Sense... So was removed by the csdn blog, fortunately there are enthusiastic big room (@ Dafang) at that time reprinted to his blog (http://dafang.sinaapp.com /? P = 948 ). The modified version was released today, and the sensitive version was deleted... Sense... Information, and corrected some incorrect or outdated information.