How to freeze a requirement with pipenv?
Pipenv do natively implement freezing requirements.txt. It is as simple as:
pipenv lock -r > requirements.txt
Assuming you have your virtual environment activated, you have three simple approaches. I will list them from less verbose to more verbose.
pip
$ pip freeze > requirements.txt
pip3
$ pip3 freeze > requirements.txt
If a virtual environment is active, pip
is most certainly equivalent to pip3
.
pipenv run
$ pipenv run pip freeze > requirements.txt
$ pipenv run pip3 freeze > requirements.txt
pipenv run
spawns a command installed into the virtual environment, so these commands are equivalent to the ones run without pipenv run
. Once again, it is assumed that your virtual environment is active.