The pipenv Package
Pipenv provides an alternative command-line utility for installing third-party Python packages and managing Python versions and package dependencies.
Reference:
http://docs.python-guide.org/en/latest/dev/virtualenvs/#virtualenvironments-ref <-- an awesome guide to help you get started
Installation
When installing Pipenv, one option is to install it via Pip, almost like you would any other Python package:
pip install --user pipenvHowever, for Mac users, you can alternatively install Pipenv via Homebrew (recommended):
brew install pipenvUsage
Setup
After installing Pipenv, you will mostly be using it from the root directory of some project repository to manage packages and versions. So navigate to your project directory:
From your project's root directory, install a new virtual environment:
This should create two files in the root directory of your project repository: a Pipfile and a Pipfile.lock.
NOTE: for some Windows users, you might not see these files, but the virtual environment is still created.
Installing Project-specific Packages
To install a specific package:
This will add the package to the project's Pipfile and Pipfile.lock, and make it available for use by scripts run within the project's virtual environment.
Running a Virtual Environment
From your repository's root directory, enter into a virtual environment with all the specified packages installed and ready to use:
From within the virtual environment, you should be able to examine its Python installation and execute scripts as usual:
When you are done, type exit and press enter to leave the virtual environment and return to your normal command-line experience.
Last updated
Was this helpful?