Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Table of contents



How to export/import dependencies for offline installation:

  • export:

    $ cd /path/to/online-python/project
    $ . ./venv/bin/activate
    $ pip freeze | grep -v "pattern-to-exclude" > /path/to/requirements.txt
    $ pip download -d /path/to/offline-dependencies -r /path/to/requirements.txt
    $ deactivate

  • import:

    $ cd /path/to/offline-python/project
    $ python -m venv otherenv
    $ . ./otherenv/bin/activate
    $ pip install --no-index --find-links /path/to/offline-dependencies -r /path/to/requirements.txt

If this cheat sheet has been useful to you, then please consider leaving a star here.