How to install Pipenv and use it for package version management

Published : Feb 3, 2024

Why we need pipenv

We previously looked at the ability to manage various python versions. This is the main piece of software that we will be using to create our programs. You can think of python as the main builder on a building site. The builder has his brain, his hands, eyes etc. all of which allow him to build a house.

That builder won’t just use his hands though, he’ll deploy tools to make him faster and more efficient. That is where packages come in. These are mini bundles of software which allow us to be faster and more efficient. For example, instead of writing out all the code for web scraping stock price data from yahoo finance, we might use a package called yfinance which is a small bundle of code.

Now if you were to give an electric drill to a builder in the 19th century, he wouldn’t know what to do with it. Similarly, if you try to use a new package on an old version of python, it won’t be able to work. This is where ‘virtual environments’ come into play. In programming, we set up these environments to ensure all python versions and package versions are compatible. The environment will lock in a version of python and ensure the packages installed are compatible.

How to install pipenv

Installing pipenv is straightforward and can be done using pip, Python's package manager. Here are the steps to install pipenv:


Ensure you have Python installed on your system.


requires Python to run.

Make sure


is installed and up to date. You can check your


version and update it using the following commands:

Installation Steps





: Run the following command in your terminal or command prompt to install



Verify Installation

: After installation, you can verify that


is installed correctly by checking its version:



to Path (if necessary)

: If your system does not recognize the


command after installation, you may need to add it to your system's PATH. The installation process usually takes care of this, but it can sometimes be necessary to do it manually, especially on Windows.

Using pipenv

To start using


in a project, navigate to your project directory and run:

To install a package and add it to your


, use:

To activate the virtual environment, run:

Additional Information


is commonly used in development environments. For production, the


is used to install exact versions of dependencies to ensure consistency.


is particularly helpful when working on multiple Python projects, as it manages separate virtual environments for each project.

Remember, the effectiveness of pipenv can depend on how Python and pip are set up on your system, so make sure those are configured correctly before installing pipenv.