I created a new project and knew at some point I would have to look into how requirements.txt files are created. I'm still in the early stages of the project though, so I didn't really look into it. As luck would have it, I accidentally came across it while looking up something else. It's so easy! All I have to do is run a command while my virtual environment is active.
pip freeze > requirements.txt
Running the command pip freeze alone would list out all the third party packages that have been installed along with their version numbers. Using the command above puts it all into a file named requirements.txt. Technically I could name the file anything I want but it appears to be convention to name it thus. This way, anyone who clones your project can easily install the packages and run the project.
Reference: https://towardsdatascience.com/virtual-environments-104c62d48c54
Comments
Post a Comment