1.下载单个文件
例如:

pip3 download requests -d /tmp/py3
Collecting requests
  Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
  Saved /tmp/py3/requests-2.21.0-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests)
  Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
  Saved /tmp/py3/certifi-2018.11.29-py2.py3-none-any.whl
Collecting idna=2.5 (from requests)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
  Saved /tmp/py3/idna-2.8-py2.py3-none-any.whl
Collecting chardet=3.0.2 (from requests)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
  Saved /tmp/py3/chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3=1.21.1 (from requests)
  Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
  Saved /tmp/py3/urllib3-1.24.1-py2.py3-none-any.whl
Successfully downloaded requests certifi idna chardet urllib3

ls /tmp/py3/
certifi-2018.11.29-py2.py3-none-any.whl  chardet-3.0.4-py2.py3-none-any.whl  idna-2.8-py2.py3-none-any.whl  requests-2.21.0-py2.py3-none-any.whl  requirements.txt  urllib3-1.24.1-py2.py3-none-any.whl

2.下载多个文件
比如下载 django 1.8.11版本和simplejson 3.14.0版本的包
那么就将所需的包写入  requirement.txt
那么我的requirement.txt内容就是:
django==1.8.11
simplejson==3.14.0
如果还需要其他的包可以依次写,注意一定要写清楚自己所需的版本号避免使用的时候出错。
例如:想将包放在\home\packs目录下
那么就在命令行窗口输入:pip download -d \home\packs -r requirement.txt


3.离线安装

下载指定的包到指定文件夹。
          pip list #查看安装的包
          pip freeze > requirements.txt   将已经通过pip安装的包的名称记录到 requirements.txt文件

安装指定的离线包     
 pip install --no-index --find-links=d:/python27/packs/ falsk    ##安装单个包 
 pip install --no-index --find-links=d:/python27/packs/  -r requirements.txt  ##安装多个包

查看安装路径
pip show requests
Name: requests
Version: 2.7.0
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/site-packages
Requires: 
Required-by: docker, docker-py, docker-compose
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


指定安装路径
 /usr/local/bin/pip2 install numpy --target=/usr/local/lib/python2.7/site-packages


08-30 02:15