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. 重新学习之spring第一个程序,配置IOC容器

    第一步:导入相关jar包(此范例导入的是spring3.2.4版本,spring2.5版本只需要导入spring核心包即可) 第二步:在项目的src下配置applicationContext.xml的 ...

  2. cypress 端到端测试框架试用

    cypress 包含的特性 端到端测试 集成测试 单元测试 安装 yarn add cypress --dev 运行测试项目 初始化项目 yarn init -y 安装cypress yarn add ...

  3. 关于mybatis中一级缓存和二级缓存的简单介绍

    关于mybatis中一级缓存和二级缓存的简单介绍 mybatis的一级缓存: MyBatis会在表示会话的SqlSession对象中建立一个简单的缓存,将每次查询到的结果结果缓存起来,当下次查询的时候 ...

  4. Django的认证系统 auth模块

    Django自带的用户认证 我们在开发一个网站的时候,无可避免的需要设计实现网站的用户系统.此时我们需要实现包括用户注册.用户登录.用户认证.注销.修改密码等功能,这还真是个麻烦的事情呢. Djang ...

  5. 显示Deprecated: Assigning the return value of new by reference is deprecated in解决办法

    很多朋友的php程序当php的版本升级到5.3以后,会出现”Deprecated: Assigning the return value of new by reference is deprecat ...

  6. Androoid studio 2.3 AAPT err(Facade for 596378712): \\?\C:\Users\中文文件夹\.android\build-cache

    错误如下: Error:Some file crunching failed, see logs for details Error:Execution failed for task ':app:m ...

  7. 【linux】linux DD命令

    Linux-dd命令详解 dd 是 Linux/UNIX 下的一个非常有用的命令,作用是用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换. 例1:要把一张软盘的内容拷贝到另一张软盘上,利用/t ...

  8. 【linux】用户与组

    一.用户和组的基本概念                                               1.用户 用户:用于获取计算机资源或服务的标识符,比如用户名.计算机处理的是UID, ...

  9. JAVA面向对象编程课程设计——项目部署

    目录 一.Java环境的安装 1.下载 2.安装 3.配置环境变量 二.Tomcat的安装 1.下载 2.安装 3.启动Tomcat(默认已经安装好java环境,如果未安装java会报错.) 三.My ...

  10. Spring整合Hibernate,Druid(Maven)

    本文转载自:http://blog.csdn.net/lantazy/article/details/52495839 首先,说一下spring,spring有很好的整合能力,Web应用的各个层次都能 ...