A few commands/snippets to simplify working with python virtual environment with Pipenv
Photo by Boxed Water Is Better on Unsplash
Requirements file
To get **requirements.txt
** file out of the pipenv virutal environment:
$ pipenv run pip freeze > requirements.txt
Install dependencies from the requirments file
Make sure to **cd
** into the project folder, then run:
$ pipenv shell
$ pipenv install -r path/to/requirements.txt
Cache Clear
To clear the **pipenv
** lock cache in case something goes wrong, run:
$ pipenv lock --pre --clear
Release space from old project environments
We make virtual environments for each project and then forget about it. You can delete the virtual environments of old projects and free up needful space on your system by going into:
$HOME/.local/share/virtualenv/
and deleting the project folders manually.
I hope this was helpful, see you in the next one! :)
If you haven’t followed *This Code yet, do make sure to do it now! More awesome, handy code snippets and tutorials coming right on!*