math module for Decimals

Mark Dickinson dickinsm at gmail.com
Tue Jan 6 05:44:56 EST 2009


On Mon, Jan 5, 2009 at 4:50 PM, alex goretoy
<aleksandr.goretoy at gmail.com> wrote:
> I get this when importing decimal:
>
> Python 2.7a0 (trunk:68339M, Jan  5 2009, 05:18:41)
> [GCC 3.4.6] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import decimal
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/decimal.py", line 138, in <module>
>     import math as _math
> ImportError: No module named math
>>>>

It's working fine for me.  I assume that a simple "import math"
also fails?  A couple of possibilities:

(1) the math module built, but Python is looking in the wrong
place for it, for some reason.

(2) the math module failed to build.  If you look at the end of
the make output, you'll probably see some lines that look like
the following (but with different modules listed).

Python build finished, but the necessary bits to build these modules
were not found:
bsddb185           gdbm               linuxaudiodev
ossaudiodev        spwd               sunaudiodev

If math is included in the modules listed, then I'd very much
like to know about it.

Mark



More information about the Python-list mailing list