pip wheel

wheel packages Python packages (even with C extensions) into ZIP-like files: .whl, unpacks and installs them directly when using pip install --use-wheel. So you don't have to re-download and re-compile these packages every time you run pip install.


$ pip install -U pip
$ pip install wheel

# archive current directory that contains a setup.py file
$ pip wheel .
$ pip install mamba_client-0.0.1-py2.py3-none-any.whl

# archive all packages in requirements.txt
$ pip wheel --wheel-dir=/tmp/wheelhouse -r requirements.txt
# or
# export PIP_WHEEL_DIR=$HOME/.cache/pip/wheels
$ pip wheel -r requirements.txt

$ pip wheel -r requirements.txt
# 之後再執行一次 pip wheel 就會出現類似這樣的訊息:
# Collecting bleach==1.2.2 (from -r requirements.txt (line 1))
#   File was already downloaded /home/travis/.cache/pip/wheels/bleach-1.2.2-py2-none-any.whl

# --no-index: Ignore package index (only looking at --find-links URLs instead).
$ pip install --use-wheel --no-index --find-links=/tmp/wheelhouse