Python libraries portable?

Terry Reedy tjreedy at
Fri Jun 8 16:52:58 CEST 2012

On 6/8/2012 4:09 AM, Alister wrote:
> On Thu, 07 Jun 2012 20:20:47 +0000, jkells wrote:
>> We are new to developing applications with Python.  A question came up
>> concerning Python libraries being portable between Architectures.
>> More specifically, can we take a python library that runs on a X86
>> architecture and run it on a SPARC architecture or do we need to get the
>> native libraries for SPARC?
>> Thanking you in advance
> That would depend on the particular module
> if it is a pure python module then it will work anywhere

Unless it uses one of the few things that are system dependent. But 
these are marked in the docs (example: "Abailability: Unix") and are 
mostly in the os module. An example is os.fork. There are also some 
system-specific things in the socket module, although it embodies much 
effort to make things as cross-platform as possible.

> if it is a C module for example cStringIO then it would be architecture
> dependent.
> some modules are wrappers to external library's (example GTK) so for
> those to work the necessary library files would need to be available
> if you are using modules that are in the standard library (except some
> platform specific ones ) then they should be available across all
> platforms, otherwise you would need to check
> see http://docs.python/library for details of the standard library

Terry Jan Reedy

More information about the Python-list mailing list