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

python pip 代理设置的更多相关文章

  1. pip 代理设置,坑爹的代理继续

    Linux ubuntu 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Lin ...

  2. python pip下载设置

    安装命名为 pip install -i 网址 所需要安装的库名例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests ...

  3. [python]通过urllib2设置代理访问网址

    #!/usr/bin/env pythonimport urllib2 # change followings before useuser = 'foo'passwd = 'bar'proxyser ...

  4. 为 pip install 设置 socks5 代理

    参考 How to use pip with socks proxy? 为 pip install 设置 socks5 代理 设置方法: pip install pysocks pip install ...

  5. python + seleinum +phantomjs 设置headers和proxy代理

    python + seleinum +phantomjs 设置headers和proxy代理     最近因为工作需要使用selenium+phantomjs无头浏览器,其中遇到了一些坑,记录一下,尤 ...

  6. 设置pip代理

    参考: python-proxy-for-pip 设置pip代理 pip install -i http://pypi.douban.com/simple xxx 2018.4

  7. Python基础 - eazy_install和pip源设置

    在国内一般推荐豆瓣的源,虽然工作中用到的都是公司内部的源,出于安全考虑这里就不拿公司的源举例了~ 1. pip源设置 打开~/.pip/pip.conf文件,若文件不存在则创建文件或者直接mkdir ...

  8. 人性化的Requests模块(响应与编码、header处理、cookie处理、重定向与历史记录、代理设置)

    Requests库是第三方模块,需要额外进行安装.Requests是一个开源库 pip install requests 去GitHub下载回来,进入解压文件,运行setup.py 比urllib2实 ...

  9. http错误和异常处理,认证和代理设置

    http错误: import urllib.requestreq = urllib.request.Request('http://www.python.org/fish.html')try:urll ...

随机推荐

  1. HDU5296 Annoying problem(LCA)

    //#pragma comment(linker, "/STACK:1677721600") #include <map> #include <set> # ...

  2. test20181018 B君的第三题

    题意 B 君的第三题(shenyang) 题目描述 客似云来,万里无云 B 君得到了一个数组\(\{a_1,a_2,\dots,a_n\}\). B 君想通过修改让数组中个每对数都互质. 每次使一个数 ...

  3. 转-Vue.js2.0从入门到放弃---入门实例(一)

    http://blog.csdn.net/u013182762/article/details/53021374 标签: Vue.jsVue.js 2.0Vue.js入门实例Vue.js 2.0教程 ...

  4. streamsets 丢踢无关数据

    对于不需要的数据,streamsets 可以方便的设置丢踢,我们可以通过定义require 字段或者前置条件进行配置 require(必须字段) 必须字段是必须存在一条record 中的,对于不存在的 ...

  5. 对ashx请求用Gzip,Deflated压缩

    //GZIP压缩 //查看请求头部 string acceptEncoding = context.Request.Headers["Accept-Encoding"].ToStr ...

  6. 949. Largest Time for Given Digits

    Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 hour t ...

  7. CentOS6.6安装(转)

    2015-3-6CentOS6.6安装 环境:工控机 1.选择安装software development workstation,其他参考以下文档过程 一.安装CentOS 6.6,安装结束重新启动 ...

  8. SpringCloud初体验:一、Eureka 服务的注册与发现

    Eureka :云端服务发现,一个基于 REST 的服务,用于定位服务,以实现云端中间层服务发现和故障转移. Eureka 可以大致理解为 房产中介 和 房东 的关系,房东想让租客租房子,首先要把房子 ...

  9. 为eclipse安装python、shell开发环境和SVN插件

    http://www.crazyant.net/1185.html 为eclipse安装python.shell开发环境和SVN插件 2013/08/27 by Crazyant 暂无评论 eclip ...

  10. gradle windows上面安装配置

    本文转载自: http://blog.csdn.net/u011546806/article/details/44806513 前提条件 安装jvm,并配置好了java环境变量 安装步骤 1.下载gr ...