Search code examples
pythonnode.jsnpmpip

Does python pip have the equivalent of node's package.json?


In NodeJS's npm you can create a package.json file to track your project dependencies. When you want to install them you just run npm install and it looks at your package file and installs them all with that single command.

When distributing my code, does python have an equivalent concept or do I need to tell people in my README to install each dependency like so:

pip install package1
pip install package2

Before they can use my code?


Solution

  • Once all necessary packages are added

    pip freeze > requirements.txt
    

    creates a requirement file.

    pip install -r requirements.txt
    

    installs those packages again, say during production.