looking into python...

crankypuss invalid at invalid.invalid
Fri Mar 4 05:53:12 EST 2016


Steven D'Aprano wrote:

> On Thu, 3 Mar 2016 09:45 pm, crankypuss wrote:
> 
>> Ben Finney wrote:
>> 
>>> crankypuss <invalid at invalid.invalid> writes:
>>> 
>>>> "Python code can be packaged into stand-alone executable programs
>>>> for some of the most popular operating systems, allowing the
>>>> distribution of Python-based software for use on those environments
>>>> without requiring the installation of a Python interpreter."
>>>> (wikipedia)
>>>>
>>>> How correct is that?  Which "most popular operating systems" are
>>>> those?
>>> 
>>> Python's web site covers this. The Python environment is available
>>> for download <URL:https://www.python.org/downloads/> for all major
>>> operating systems.
>> 
>> Looking at https://www.python.org/downloads/release/python-344/
>> it appears that "all major operating systems" includes "Mac OS X",
>> "Windows", and "Source release".  I'm seeing nothing about Android,
>> or
>> BlackBerry OS-10, or mainframes, or linux.  Presumably the source
>> code
>> has been pre-built for linux in various distro repositories.  Maybe
>> I'm missing the obvious as usual.
> 
> Yes, all the major Linux distros (Red Hat, Centos, Fedora, Debian,
> Ubuntu, Mint, Suse, ...) will either install Python by default or at
> least provide it through their official package management software.
> 
> Likewise, FreeBSD and OpenBSD certainly have Python available.
> 
> I doubt Blackberry has Python available, but that's hardly a major or
> important platform.

I'd say its importance depends on what kind of phone you carry. <g>

FWIW, "BlackBerry 10 is based on QNX, a Unix-like operating system that 
was originally developed by QNX Software Systems until the company was 
acquired by BlackBerry in April 2010."

from https://en.wikipedia.org/wiki/BlackBerry_10

> For Android, the answer is mixed. I don't have an Android device to
> try it on, but I'm told that it is possible to install Python on
> Android, but it may be difficult. Probably the easiest way is to
> install Kivy:
> 
> https://kivy.org/
> 
> Kivy is a cross-platform Python development system that runs on OS X,
> Linux, Windows, iOS (iPad, iPhone) and Android.
> 
> For mainframes, the answer is maybe". If your mainframe supports the
> C89 standard, it will probably work. If it can run x86 machine code,
> or emulate it in a VM, that's probably the way to go.
> 
> Some older versions of Python supported mainframes like VMS, but in
> 2011, support for OS\2, VMS and Windows 2000 was dropped:
> 
> http://blog.python.org/2011/05/python-33-to-drop-support-for-os2.html
> 
> There is a Nokia project called PyS60 that runs Python on Nokia Series
> 60 mobile phones. I don't know if it is still maintained.
> 
> Classic Mac OS (System 9 and older) was supported in older Python
> versions, but not the more recent ones.
> 
> I don't think there has ever been a version of Python that ran on DOS
> :-)

It sounds as though Python will run on pretty much anything that's close 
to POSIX-compliant?

>> Referring back to the wikipedia quote at the start of the post, I'm
>> interested in how Python code is packaged into stand-alone
>> executables.
> 
> I'm only really familiar with the situation on Linux.

That's where I'm from these days.

> On Linux, you
> usually wouldn't bother. Since Python is almost always already
> installed on the system, and even if it is not, it's usually only a
> single command away (like `yum install python`, say), there's very
> little point in packaging your scripts or applications up in a
> stand-alone exe file.

Nice, with PHP it isn't so easy; not only is there often no PHP 
interpreter, to install one you have to fiddle with a config file.

> Somewhat intermediate between stand-alone exe applications and a
> directory full of scripts is to create a package, compress it into a
> zip file, and run that zip file with the Python interpreter installed
> on your system. Since it relies on there being an external Python
> interpreter, it's not exactly stand-alone, but it may be close enough
> for what you're doing.

Reminds me of docker stuff.

> Python packages are dead-simple: create a directory called "foo", and
> put a file inside it called "__init__.py". It can even be an empty
> file. That's a package. Obviously there is more to it than that, but
> that's the basics.

Okay, thanks.

-- 
http://totally-portable-software.blogspot.com
  [Mon Feb 29: "Addresses - What Good Are They?"]




More information about the Python-list mailing list