[PYTHON] About requirements.txt

Introduction

If you are using Python's Django, you need to reflect the software installed locally that you worked on when sharing it on github or reflecting it in the production environment.

"Requirements.txt" is convenient in such a case.

In a nutshell, it's a file that lists the packages you need to pip install on your project.

By using "requirements.txt", you can reduce the trouble of building the environment.

When creating a file

First, output requirements.txt to a file.

In the terminal, move to the directory where you want to generate the target file and enter the following command to execute it.

$ pip freeze > requirements.txt

When you run it, "requirements.txt" is generated, so you can check the contents with `vim requirements.txt` for confirmation.

When installing files

Next, copy this requirements.txt to another environment and install it all at once.

Enter the following command in the terminal of the target project.

$ pip install -r requirements.txt

After the installation is complete, check the contents of the installed package with pip list and if there is no difference, you are done.

in conclusion

During development, an error may occur just because the version of the target package is different, but you can work efficiently by managing it in requirements.txt.

Even when asking a question to a person, matching the contents of the installed package with the question may lead to a faster solution to the problem, so I would like to make good use of it.

Recommended Posts

About requirements.txt
About LangID
About CAGR
About virtiofs
About python-apt
About Permission
About sklearn.preprocessing.Imputer
About gunicorn
About locale
About permissions
Split requirements.txt
About Opencv ②
About axis = 0, axis = 1
About Opencv ③
About import
About numpy
About pip
About Linux
About numpy.newaxis
About endian
About Linux
About import
About Opencv ①
About Linux
About Linux
About Linux ①
About cv2.imread
About _ and __
About wxPython
Notepad about TecoGAN
About python slices
Briefly about __name__
About Docker Volume
[Linux] About export
How to share a virtual environment [About requirements.txt]
About reference type
About Twitter scraping
About the test
Learn about programming
About Flask customization
About variable scope. .. ..
About Python tqdm.
About python yield
Notes about with
About python, class
About Linear Models
About Go functions
About pandas describe
About Kivy root
About Firestore timeout
About python inheritance
About python, range ()
About Confusion Matrix
[Linux] About PATH
About python decorators
Linux (about groups)
Note about awk
About python reference
About Bitnami Autostart
About Python decorators
About Milkcocoa SDK