Skip to content

[PyCharm] How to export the requirements file from PyCharm

When we browse many Python repositories, we often see a “requirements.txt” file in repository. This file can help us to install the exact same package versions as the project was during development.

The method to use this file is very simple:

sudo pip3 install -r requirements.txt

And the computer will download and install by itself.


Export PyCharm requiremnts

I mentioned in PyCharm Installation Tutorial, A famous Python IDE, each project has its own virtual environment, and it keeps the packages from conflicting with each other. (I had encountered conflicting problem with Pillow packaage.)

So, how do we export the requirements.txt file in PyCharm?

First, you need to open the PyCharm terminal:

Terminal button at the bottom.

And we key in the instruction:

pip3 freeze > requirements.txt

We will write the required package into requirements.txt file.

Let’s double check:

Prints requirements.txt:

How is it? Is it the same?

5 thoughts on “[PyCharm] How to export the requirements file from PyCharm”

  1. It doesn’t work, brother.

    ‘pip’ is not recognized as an internal or external command, operable program or batch file.
    When I added my folder path to the system environment, it still showed the same message.

    Finally, I copied pip.exe and pip-script.py to the same folder, it said Unable to create process using ‘C:\….python.exe C:\…pip-script.py freeze ‘

    Please let me know how to address this problem. Thank you.

  2. It worked for me! I’m now adding this step to my Python workflow for all projects. Thanks very much!!

Leave a Reply