Last Updated on 2021-06-08 by Clay
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:
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?
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.
Hello, nice to meet you.
I want to confirm first. Do you restart your pycharm after you add the path to system environment?
In my case, it’s always a path problem.
Maybe you can refer this article: https://appuals.com/fix-pip-is-not-recognized-as-an-internal-or-external-command/
Are you working with pycharm?
In the pycharm project, if your program can be worked, “pip” can also worked normally.
It worked for me! I’m now adding this step to my Python workflow for all projects. Thanks very much!!
It’s my pleasure. =)