LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-30-2013, 11:32 AM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
Running a 'python' program on 'Windows"


Is a program written in 'python' cross platform compatible?
If I type from a terminal:
Code:
python plot-houston.py
to run it on my Linux system, how do I run it on a Windows or Apple computer?
 
Old 09-30-2013, 12:07 PM   #2
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
In theory... Of course, you do have to get Python installed first! Have a look at this
http://docs.python.org/2/faq/windows.html
 
1 members found this post helpful.
Old 09-30-2013, 12:10 PM   #3
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
That's a "depends" type question. It depends on the dependencies of the python program and how it is installed on windows/mac. If all of the modules are available and installed on all three platforms and the python code isn't using any platform specific code (e.g. search the proc filesystem for stats and info which is only available on Linux) then it is highly possible the script can be run on multiple platforms with little or no modification.

As for how you run that script on the other platforms it depends on how the user installed python. In Windows if there's %PATH% and explorer integration then one could simply double click on the *.py script to run it (though it may disappear right away depending on what it is doing if it doesn't pause to show output). If there's %PATH% integration then one could also open the command prompt and run the script the same way you do on Linux.

With Mac it also depends on the package and how it integrates with the system though most recommended methods for Mac have $PATH integration. It is BSD based and uses bash for the terminal shell so just run it like you would any other.

For a more specific answer you'll need to provide more information or code samples with your question and describe the client environment.

Last edited by sag47; 09-30-2013 at 05:03 PM.
 
1 members found this post helpful.
Old 09-30-2013, 05:30 PM   #4
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Thank you for the replies. You have given me more information than I knew that I was supposed to ask........

I guess my fishing club will have to do without this membership information.
 
Old 09-30-2013, 08:22 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
The short-answer is that languages such as Python, Perl, PHP, Ruby and so-on are generally designed to be, at least, "operating-system agnostic." The core-language will run anywhere on anything. However, the reality is that the operating systems are different-enough to cause problems in the various edge-cases. Therefore, if you are deploying an application that is intended to be "cross-platform," a certain amount of care must be taken. Perhaps your requirements are "nowhere near 'the edge.'" On the other hand, maybe they are.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python/Bash script to check conditions for running "poweroff" command gnuub Programming 3 12-04-2012 03:31 AM
[SOLVED] I get "'found module version 0, expected 9" Error while running a fortran 90 program. msbstar Linux - Newbie 4 09-16-2012 02:44 PM
Python "support" included in C program ITPhoenix Programming 2 07-11-2011 07:17 PM
Python program not running from cron spiri Linux - Software 7 03-09-2006 02:02 AM
User "list" running process "python" TroelsSmit Linux - Newbie 2 02-22-2005 04:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration