---
title: "Python安装pip设置HTTP代理下载第三方库之类"
author: "fall10"
date: "2017-11-01T16:56:29Z"
tags: []
categories: ["编程语言"]
slug: "python-pip-http"
draft: false
lastmod: "2017-11-01T16:52:38Z"
id: 2398338
url: "https://fall10.iteye.com/blog/2398338"
---

环境是：Win7下，公司内网，需要通过HTTP代理并鉴权，并且需要SSL证书访问外部HTTPS网站

目标是：为安装的python3.6下载第三方库Pillow

看了网上很多不同背景的文章片段，尝试了很多组合终于尝试成功，先记录一下格式及路径：

1，进入python的脚本目录：

```
c:> cd /d D:\Programs\Python36\Scripts
```

 2，安装pip，执行命令

```
easy_install.exe pip
```

 3，执行pip命令，安装第三方库Pillow，最终格式是：

```
pip install --proxy http://usernamexxx:passwordxxx@proxyip:proxyport --cert C:\xxxx.cer Pillow
```

 附，成功下载安装日志：

```
Collecting Pillow
  Downloading Pillow-4.3.0-cp36-cp36m-win32.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 40kB/s
Collecting olefile (from Pillow)
  Downloading olefile-0.44.zip (74kB)
    100% |████████████████████████████████| 81kB 32kB/s
Installing collected packages: olefile, Pillow
  Running setup.py install for olefile ... done
Successfully installed Pillow-4.3.0 olefile-0.44
```

 附，代理格式正确，缺少SSL证书的日志：

```
Collecting Pillow
  Could not fetch URL https://pypi.python.org/simple/pillow/: There was a problem confirming the ssl
 certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) - skipping
  Could not find a version that satisfies the requirement Pillow (from versions: )
No matching distribution found for Pillow
```