python pip 代理设置


pip install --proxy="user:password@server:port" packagename

origin url:
http://xiuxixiuxi.blogspot.jp/2013/04/how-to-install-packages-with.html

There are two easy way to install packages for python (regardless of the platform you're using), namely easy_install and pip. The later is actually an overlay on the former.

They work very nicely, except with pesky proxies. Both of them have the ability to download through proxy, but they use different syntax.

For pip you will simply add the option '--proxy' to indicate the proxy address like so:
pip install --proxy="user:password@server:port" yourpackage

Whereas easy_install will rely on environment variables, http_proxy, https_proxy , ftp_proxy

#for linux / unix
export http_proxy="user:password@server:port"
export https_proxy="user:password@server:port"
export ftp_proxy="user:password@server:port"

#windows
set HTTP_PROXY="user:password@server:port"
set HTTPS_PROXY="user:password@server:port"
set FTP_PROXY="user:password@server:port"

If you want those settings to persist, don't forget to add them to your bashrc, or through your windows settings


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM