I have recently learned about requirements.txt in python. Perhaps it is because it is too simple and I have not found a more complete introduction on the Internet. Therefore, this article mainly introduces the relevant information about requirements.txt in python. Friends who need it can For reference, let’s take a look below.
Introduction
The Python project must contain a requirements.txt file to record all dependent packages and their precise version numbers. for deployment in new environments.
The main writing methods are as follows
pip freeze > requirements.txt # 生成requirements.txt pip install -r requirements.txt # 从requirements.txt安装依赖
Supported writing methods
-r base.txt # base.txt下面的所有包 pypinyin==0.12.0 # 指定版本(最日常的写法) django-querycount>=0.5.0 # 大于某个版本 django-debug-toolbar>=1.3.1,<=1.3.3 # 版本范围 ipython # 默认(存在不替换,不存在安装最新版)
Third-party tool generation
pip freeze will come with some unnecessary packages, as well as packages that some packages depend on~
pipreqs automatically analyzes referenced packages in the project. When automatically building the Django project, the Mysql package was ignored, and the version was also very strange; and when searching for on the Internet, it encountered a 404 error and jumped out.
The above is the detailed content of Detailed introduction to the entire contents of requirements.txt. For more information, please follow other related articles on the PHP Chinese website!