How do I run Python based software from SourceForge?
There isn't a straightforward answer to this question because projects on SourceForge often provide software both in source form as well as in binary (executable) form. Consider the MySQL for Python packages, available via the "Download" link on the project page: in this case, you'll choose mysql-python and be presented with a list of files (under "Filename").
If you use Windows, you'll probably only need to download and run the executable installers (ending in .exe).
If you use another platform, at least for other packages there might be similar binary packages (ending in .rpm or .deb, for example) which you would then install using the system's package manager.
For files ending in .egg you can use easy_install to install the software and make it available on your system.
For archive files ending in .zip, .tar.gz or .tgz, .tar.bz2 or .tbz2, you need to unpack the software and build it from the sources, typically.
Building files from source (the last alternative above) can be tricky, but the general procedure is usually something like this:
- Inspect the archive file to see what the unpacked file will produce: you don't want the unpacking process to put files all over the place. For example:
unzip -l package-1.0.zip tar ztf package-1.0.tar.gz tar jtf package-1.0.tar.bz2
If the output of the above suggests that the files inside the archive will appear in a common directory (package-1.0, for example) then move on to the next step. Otherwise, make a new directory and move into it:
mkdir package-1.0 cd package-1.0
- Now unpack the archive using one of the following:
unzip package-1.0.zip tar zxf package-1.0.tar.gz tar jxf package-1.0.tar.bz2
If you created a new directory, you may need to refer to the archive in the parent directory (../package-1.0.zip, for example). You can skip the next step, though.
- Enter the root directory of the package, just created when you unpacked the archive:
Now read the documentation! There will probably be a README or INSTALL file in the directory - this will explain the rest of the installation procedure.
Some software can be run straight from the unpacked archive - this will usually be mentioned in the documentation, but it can be quite common for games written using PyGame to have a run_game.py (or run_game.pyw) file, and you can just run that with python.
Other software will provide a setup.py program which can be used to install the software.