Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a python program be run on a computer without Python? What about C/C++?

Tags:

c++

python

c

Can I create a Python program, send it to a remote computer, and run it there without that computer having Python installed? I've heard that you cannot, as Python needs to be interpreted. If this is true, then it seems very odd as it would be hard to distribute your program unless everyone decides to install Python.

Also, what about C and C++? Can they be run on a remote computer without having the language installed? (I think you can, as it is a compiled language).

I'm not exactly sure and would like clarification.

EDIT:

I'm getting some mixed answers on this and am not sure where to go. I see that I can include the Python library in the program and I can use py2exe.

However, I'm confused on C and C++. Do I have to include their libraries in the program? Can they only be run on certain machines? Does the compiler allow it to run on all machines?

like image 466
Justin Avatar asked Feb 04 '11 02:02

Justin


1 Answers

Look at py2exe and py2app for Windows and Mac. Macs running OSX and most modern Linuces have Python installed, however.

C/C++ apps are normally compiled to executables which work on one machine/OS architecture (e.g. 32-bit Windows, or 64-bit OSX); such an executable can run on some but not all machines. For example, 64-bit Windows or OSX can run programs built either for the 32-bit or 64-bit flavor of their respective OSes.

like image 163
Russell Borogove Avatar answered Sep 27 '22 16:09

Russell Borogove