Determining 32 bit vs 64 bit Python and numpy

372 views
Skip to first unread message

mma...@gmx.net

unread,
May 25, 2009, 5:22:51 PM5/25/09
to
Hi

I am looking for a robust, cross-platform way to determine if I am on a
32 bit or a 64 bit Python and if the numpy installation is also 32 bit
or 64 bit.

I have googled a bit and found some platform specific solutions but
nothing general.

The solution should work with different versions of Python (>= 2.4).

Thanks in advance

Martin

"Martin v. Löwis"

unread,
May 25, 2009, 5:54:45 PM5/25/09
to
> I am looking for a robust, cross-platform way to determine if I am on a
> 32 bit or a 64 bit Python and if the numpy installation is also 32 bit
> or 64 bit.

You can find out the size of a pointer with struct.calcsize("P") * 8.
Numpy will have the same configuration if you can import it.

Regards,
Martin

mma...@gmx.net

unread,
May 25, 2009, 6:07:56 PM5/25/09
to


That works great. Thank you.

Best Regards

Martin

Reply all
Reply to author
Forward
0 new messages