How-to get decimal.py if you have Python 2.3.x

Batista, Facundo FBatista at uniFON.com.ar
Thu Sep 23 12:55:34 EDT 2004


How-to get decimal.py if you have Python 2.3.x
==============================================

Next I'll show you how to install the decimal.py module in your Python
2.3.x.

This module comes with the standard Python 2.4 and newer distributions; in
these cases you don't need to download it separately. Note that decimal is
not officially supported for Python 2.2 and older distributions.


Downloading the necessary files
-------------------------------

You can take two different ways here: download a module installer, or
download the files separately.

In the first case, the procedure is simple, but maybe you won't get the
latest version. In the second case, the procedure has more steps but you'll
be sure of getting the module latest version.


Using the installer
^^^^^^^^^^^^^^^^^^^

Go to http://sourceforge.net/projects/sigefi, enter to the File Releases
section and choose the package type to download:

- ``decimal-x.x.win32.exe``: Windows only.
- ``decimal-x.x-x.rpm``: For RPM based Linux distributions.
- ``decimal-x.x.tar.gz``: The simplest and most general (should work
wherever you have Python installed).

In the first case, just execute the installer. In the second case, do ``rpm
-i decimal-x.x-x.rpm`` as root.

In the third case, also as root, unzip and untar the package, go to the
created directory and execute the installer::

    gunzip decimal-x.x.tar.gz
    tar -xf decimal-x.x.tar
    cd decimal-x.x
    python setup.py install


Downloading the files separately
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The decimal module is only one file: decimal.py, which you can download from
the Python CVS:

 
http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/decimal.py

This file must be put in your Python installation ``site-packages``
directory (for example, in ``C:\Python23\FIXME\site-packages`` or in
``/usr/lib/python2.3/site-packages``). Note that you may need administrator
privileges to put the file there.

To test the installation you need additional files: test_decimal.py and the
test files (inside a directory), that you can download also from the CVS:

 
http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/test/test_d
ecimal.py
 
http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/test/decima
ltestdata/
    

Checking that everything is fine
--------------------------------

If you chose the third installation method, where you executed the installer
you'll have a ``test`` directory. If you downloaded the files separately,
you should have in a test directory the ``test_decimal.py`` file (that
directory could be anyone, as you wish) and there the ``decimaltestdata``
directory.

In any case, go to that test directory and execute the tests with::

    python test_decimal.py

You'll see a lot of messages while different module parts are tested, ending
with a message similar to::

    OK
    doctest (decimal) ... nn tests with zero failures

If there's any problem with the tests, please contact the developers.


Documentation
-------------

Where you executed the installer you'll have a ``docs`` directory. There is
the documentation in several formats:

- HTML: Open the ``index.html`` file with your favorite browser.
- Tex: The doc sources are in the ``libdecimal.tex`` file.

The .tex file was extracted from the Python CVS, and the htmls were
extracted from the on-line Python documentation (modified to get all the
Decimal related links point to the downloaded files).

You can also check the documentation via web at
http://www.python.org/dev/doc/devel/lib/module-decimal.html.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040923/99627eed/attachment.html>


More information about the Python-list mailing list