0

Is there any way to have a package.json file for my python folder, like it is in NodeJS (npm) ?

For Example: if I used pip to import Flask, I want Flask to appear in the package.json file. It doesn't have to be JSON, it can be a .txt file as well.

FYI: I want the file so that I can install all the dependencies immediatelyif I transfer the files, or upload the folder into GitHub

Thanks!

Dark Programmer
  • 482
  • 3
  • 6
  • 18

1 Answers1

5

You can save your current state of dependencies using a requirements file. One way is to generate it using pip freeze:

pip freeze > requirements.txt

You can install these requirements, again using pip:

pip install -r requirements.txt

You can read more about it here: https://pip.pypa.io/en/stable/user_guide/#requirements-files

ricekab
  • 630
  • 5
  • 17
  • 2
    Important to note that pip freeze will save all packages currently installed. Not just those in use. If you aren't using an environment or not grooming your installed packages periodically the pip freeze may save unneeded packages to `requirements.txt`. There are some python packages to remedy this issue but this is an important note for the basic `pip freeze`. – Error - Syntactical Remorse Aug 05 '19 at 13:11