Python Distutils and module distribution (part 1 - final users)
The target of this document are the final users, or a Python developer that wanna use 3rd party modules and libraries.
Part 2 will be available soons!
Standard old-way installation
First of all let me link the official guide about distutils usage.
When you download a Python module from the web and it is done in a standard way using distutils, you can install it system wide. This mean that you can install it one time and this became part of the Python libraries group of you system.
You can easilly see this if the downloaded archive has a setup.py file inside and (sometimes) a setup.cfg.
In those cases, you can easilly install the module by Python
python setup.py install
And the distutils make it all for you.
If you have more that a Python environment installed on your system, be sure that you are using the right ones.
python2.4 setup.py install
If your Python interpreter is not a system Python but you downloaded and compiled it yourself
(very common on Windows) you can of course type something like this:
/home/keul/MyPythonDownloaded/bin/python setup.py install
C:\Python2.5\bin\python.exe setup.py install
Yes, this is simple, but before choosing this way to install additional Python modules, check the second way below, that is simpler!
Egg installation from the Cheeseshop (Python Package Index)
When a developer release a library in an egg format, he can also choose to release on the Cheeseshop.
The way of doing this is very simple but we will not show it there. When (as I do) release my own library in this new way, everyone can
install packages without downloading anything but just typing:
Of course, you need an Internet connection, but after this the easy_install script do all the stuff for you.
Cool, isn't it?
The easy_install script is today available on all Python distribution, commonly the executable file is in the same folder where you'll find the "python" ones.
Again, you need to use the right easy_install if you have more that a Python distribution on your system.
Coming back to my Windows example, it will be...
- Always check for an egg on the Cheeseshop first (just make a search in the pypi site!).
- If you are a Python developer, lear how to distribute the code using distutils and how to send it to the Cheeseshop.