How do I tell if I'm running on a PowerPC?

Tim Chase python.list at tim.thechases.com
Fri Aug 19 08:38:23 EDT 2016


On 2016-08-14 13:54, Steven D'Aprano wrote:
> I need to be able to programmatically test whether I'm running on a
> PowerPC. How can I do that?
> 
> import platform
> if platform.machine() in ('ppc', 'ppc64'):
>     print('running PowerPC')
> 
> 
> Is that right?

Running OpenBSD on a PPC iBook G4:

$ python3.5
Python 3.5.1 (default, Mar  6 2016, 01:17:51) 
[GCC 4.2.1 20070719 ] on openbsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.machine()
'macppc'
>>> platform.processor()
'powerpc'

Just in case it matters.

-tkc







More information about the Python-list mailing list