Python has a package management ecosystem (libraries) integrated with both lignage and in-house packages.
PIP - a much-needed tool that became part of the new Python installs from Python 3.3 manually resolves the dependency issue for those in a hurry and does not want to leave the round package for third parties.
Of course, this assumes that your project is already running on a separate virtualenv, where the only libraries installed other than your own project are the ones you want to make sure they are installed on the target.
If you are not yet using Virtualenv for your development, take a look here:
link (or, for Python > = 3.3 venv, which comes bundled with Python ): link
In this case, you can use PIP to create a file with the list of Python libraries installed in your project - type:
pip freeze >requirements.txt
in the terminal, with virtualenv enabled. This will automatically list the libraries installed in the "requirements.txt" file - whoever installs your program, after having the code in hand, and create virtualenv, you should type:
pip -r requirements.txt
.
Python developers accustomed to picking up and placing projects on sites like github will be able to install packages and libraries following this recommendation.
But that does not answer your question - if you want a lay user to install your program, having only Python installed, this is possible - but it gives you a little more work to get it right the first time, to the developer .
You will then use "setuptools" - a Python package made for, from information about your project that you put into a file named setup.py
- This file is a small Python program where you put not only the dependencies of your project, (such as module build instructions, if there is part of the project in C or Cython), metadata about project version number, author, and use license, and so on.
setuptools causes setup.py
to function as a full command line application with several options. One of them is even direct call
python setup.py bdist_wininst
- that in a properly configured Windows environment will generate an .EXE file that installs your application and its requirements (it just does not install Python - as pyfreeze and other utilities do).
Now setuptools is used, more usually, not to create installable for Windows - and yes - to put your project, once tested and fulfilling some quality requirements, straight into Pypi - the "Python Package Index".
From there, anyone with Python and Pip (or easy_install) installed will be able to install your project simply by typing:
"pip install" (and, yes, this installs the project I and the libraries it depends on).
For Python programmers and users it turns out to be more practical than having an installer on some web site - you do not have to find the site, download the file, and run it - just enter the command. (And also your project becomes part of the list of projects that may be requirements of others.)
For the lay public to install, for example, a game made with Pygame, the form with Windows installer is certainly more convenient.
The setuptools documentation is really worth studying if you want to distribute your projects to the general public, end users or even the Python developer community. Start at the link:
link