Darren01274
Posts: 59
Joined: Fri Jul 26, 2013 7:13 pm

Phyton Programs

Sat Aug 03, 2013 6:01 pm

Hi how do you make something you created in python run in windows?

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Phyton Programs

Sat Aug 03, 2013 6:20 pm

Python is available for Windows.

If it's a simple python program without complicated links to the operating system then it should be 'portable'. Just install Python on your Windows machine, copy the .py script across from the RPi to the PC, and run it.

If it's more complicated than that, please provide more details.

For example, hopefully it is obvious that nothing that refers to the GPIO pins can be run on a Windows PC.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Guy999
Posts: 20
Joined: Tue May 14, 2013 8:37 pm

Re: Phyton Programs

Sat Aug 03, 2013 8:05 pm

A firm called active state do a version of Python for Windows. You can also boot any number of 'live' versions of Linux on any PC, from a pen drive or CD/DVD, that will have python pre-installed.

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: Phyton Programs

Sat Aug 03, 2013 10:27 pm

As previous poster said use the free Active State Python

The only problem I had porting the Pi Presents editor was the /\ difference in file paths and care was required with some system call that returned users home directoryetc.

pp_editor.py from Pi Presents which uses the Tkinter GUI works fine on Pi and Windows 7.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

spoolboyy
Posts: 23
Joined: Sat Mar 03, 2012 10:13 pm

Re: Phyton Programs

Sun Aug 04, 2013 9:00 pm

Its been stated already that Python is available for windows, but here is a link to the official distribution: http://python.org/download/

Python is free (in both senses of the word). You can download the appropriate distribution there, either 64 or 32 bit, depending on if your windows install is 64 or 32 bit. Most python programs will translate between the OS's without modifications unless specific hardware or software dependencies exist that prevent this.

- Spool

Darren01274
Posts: 59
Joined: Fri Jul 26, 2013 7:13 pm

Re: Phyton Programs

Mon Aug 05, 2013 8:28 am

Sorry I know you can get python for windows. I mean how do you make something you created in Python run on a PC that does not have python installed, so it is like a regular program.

Or will the .py file execute even if Python is not installed

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: Phyton Programs

Mon Aug 05, 2013 9:01 am

Yesyterday I downloaded and used a program called pyinstaller that will create a folder that you can copy to a PC and then run a .exe from that folder.

Italso says it can compress it all down into one .exe that unzips itself into a temp folder and then runs the .exe

regards

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

spoolboyy
Posts: 23
Joined: Sat Mar 03, 2012 10:13 pm

Re: Phyton Programs

Mon Aug 05, 2013 3:29 pm

Ah, now I see what you were asking. It is true that Python files will not run on a windows PC that does not have Python installed on it.

pyinstaller solves this problem by bundling up all of the python dependencies (including the interpreter itself) into a single .exe so that it can be distributed to people who's computers lack the Python runtime environment. I've not used pyinstaller, (in around 2007ish I used one called py2exe - not sure if its still around....), but it looks like it would do the trick for you.

- Spool

shaggy-89
Posts: 3
Joined: Thu Aug 08, 2013 10:52 am

Re: Phyton Programs

Thu Aug 08, 2013 12:01 pm

Another option you have is py2exe. Google has some great info on it and simple to use

Python setup.py py2exe

There are plenty of switches for it e.g no console. Good if you have made a gui program.

Cheers
Shane

User avatar
croston
Posts: 706
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Phyton Programs

Thu Aug 08, 2013 4:39 pm

If you are using Python 3 then take a look at cx_freeze - last time I checked it was the only way for Python 3. It also supports Python 2.

Return to “Python”