Search code examples
pythonlibraries

How to include library dependencies with a python project?


I'm working on a program which a few other people are going to be using, made in Python. They all have python installed, however, there are several libraries that this program imports from.

I would ideally like to be able to simply send them the Python files and them be able to just run it, instead of having to tell them each of the libraries they have to install and as them to get each one manually using pip.

Is there any way I can include all the libraries that my project uses with my Python files (or perhaps set up an installer that installs it for them)? Or do I just have to give them a full list of python libraries they must install and get them to do each one manually?


Solution

  • That's the topic of Python packaging tutorial.

    In brief, you pass them as install_requires parameter to setuptools.setup().

    You can then generate a package in many formats including wheel, egg, and even a Windows installer package.

    Using the standard packaging infrastructure will also give you the benefit of easy version management.