- You have a Python project in a virtual environment.
- Your project’s top-level directory contains your
Install Pipenv as explained in the docs.
cd into your project’s root directory (you hopefully have your
requirements.txt files in the root directory) and optionally switch to a branch other than
foo@bar:~$ cd my_project foo@bar:~$ git checkout -b migrate_to_pipenv
Spawn a shell. This will generate a
Pipfile from your
foo@bar:~$ pipenv shell requirements.txt found, instead of Pipfile! Converting… Warning: Your Pipfile now contains pinned versions, if your requirements.txt did. We recommend updating your Pipfile to specify the "*" version, instead. Spawning environment shell (/bin/zsh). Use 'exit' to leave.
The generated Pipfile will probably have pinned versions. It’s recommended that you convert these to ‘*’ versions (anyone knows of an automated way to do this?).
Install the packages to the new environment (this will update your packages). This will also generate a
foo@bar:~$ pipenv install Pipfile.lock not found, creating… Locking [dev-packages] dependencies… Locking [packages] dependencies… Updated Pipfile.lock (bd2078)! Installing dependencies from Pipfile.lock (bd2078)… 🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 — 00:00:01
foo@bar:~$ pipenv lock -r > requirements.txt