Python3-Generate requirement.txt file

Preface

  • In a Python project, there is usually a requirements.txt file
  • This file is mainly used to record all dependent packages and their precise version numbers under the current project to facilitate faster deployment in a new environment

How to generate requirements.txt 

Enter the project root directory and execute the following command

pip3 freeze > requirements.txt

This will report a warning

 

Means: It is best to call pip through python, so it is recommended to type the following command to generate

python.exe -m pip freeze > requirements.txt

Use requirement.txt to install third-party libraries

pip3 install -r requirement.txt

Points to note when using Pycharm

Preface

  • I believe that everyone using pycharm will create many projects
  • And each project needs to have its own python dependent environment, which is called Project Interpreter in pycharm
  • Sometimes for convenience, this Interpreter

Guess you like

Origin blog.csdn.net/yang520java/article/details/114125338