Pipenv

As pipenv aims to replace pip, you should always install Python packages in virtual environments with pipenv. DO NOT INSTALL SYSTEM-WIDE PACKAGES USING pip.

Workflow

Follow this workflow when you have to install a Python tool requiring additional packages or simply developping your own.

  1. Create a directory dedicated to the software or project
mkdir /opt/awesometool
git clone https://github.com/awesome/tool -o /opt/awesometool
  1. Install required Python packages using pipenv
pipenv [--two|--three] install -r requirements.txt
pipenv [--two|--three] install [package1 package2 ...]
  1. Create a pipenv-wrapper.sh to run the Python software or project within the venv
#!/bin/sh
cd /opt/awesometool
pipenv run python awesometool.py "$@"
  1. Symlink the pipenv-wrapper.sh to /usr/local/bin
ln -s /opt/awesometool/pipenv-wrapper.sh /usr/local/bin/awesometool.py