Export and import project dependencies

A Python project may install a lot of the installation package, creating a virtual environment again is the need to re-install a lot of trouble if too time-consuming, or the project deployment time to avoid heavy equipment,

All packages may be mounted in an existing project requirements.txt recording file, then all the other environment next key installation package.

requirements.txt file records all dependent packages and exact version number, for deployment operations in the new environment.

  • Use the following command to the current virtual environment dependencies to generate the version number to file:
pip freeze > requirements.txt
  • When you need to create a complete copy of the virtual environment, you can create a new virtual environment and run the following command on its:
pip install -r requirements.txt

We will file all of the package to the new virtual environment.

Guess you like

Origin www.cnblogs.com/qianniao2122/p/11918732.html