[PYTHON] Execution of pip command under proxy (memorial)

When I try to execute a pip command (for example, install, search, etc.) under a proxy environment, I get an error and cannot execute it.

Many people have already written similar articles, but none of them worked, so I'll note how it worked under my environment (iMac OSX Yosemite Python 3.6).

You can set the proxy settings for the pip command with --proxy = user: pass @ proxy: port, but this didn't work.

Next, how to set it directly in the environment variable

export http_proxy="user:pass@proxy:port"
export https_proxy=$http_proxy
export ALL_proxy=$http_proxy

Did not work well when I ran.

However, when I tried the same work on another PC (Macbook Pro OSX Marvericks Python 3.5), it worked.

I thought something was wrong here, so I checked if the proxy was working properly on Python.

Call python with commandline


import urllib.request
urllib.request.getproxies()

When I execute the above command and check it, why?

{'http':'"user:pass@proxy:port"','https':'"user:pass@proxy:port"','all':'"user:pass@proxy:port"'}

It was.

Here, if you remove the double quotes of ʻexport http_proxy =" user: pass @ proxy: port " and set ʻexport http_proxy = user: pass @ proxy: port, the pip command worked normally.

When I performed the same work at a later date, it worked normally even with double quotes. why?

Recommended Posts

Execution of pip command under proxy (memorial)
Pip install (Windows) under Proxy environment
When pip fails under proxy environment
python memo pip under proxy, easy_install
Use the pip command under an HTTP proxy environment that requires authentication
pip command collection
How to use pip3 under proxy environment Note
Broken pip command
Run conda / pip / gem under NTLM authentication proxy environment
memorandum of vi command
Install the pip command
Measurement of execution time
Docker under proxy environment