Search code examples
pythonportability

Is python program/executable portable?


I am a beginner to python programming language. I have seen the definition "python is portable" at https://docs.python.org/.

Query 1: Python is portable - Does it mean python scripts or python executable??

Query 2: Like JVM, for Java, is anything needed to run "python executable" on target machine.


Solution

  • Most probably you will have read somewhere that the Python language is an interpreted programming or a script language. The truth is: Python is both an interpreted and a compiled language. But calling Python a compiled language would be misleading. People would assume that the compiler translates the Python code into machine language but this is not the way python code is executed. Python code is translated into intermediate code, which has to be executed by a virtual machine, known as the PVM, the Python virtual machine. This is a similar approach to the one taken by Java. There is even a way of translating Python programs into Java byte code for the Java Virtual Machine (JVM). This can be achieved with Jython. The default implementation of python is Cython but there is more like Jython, PyPy,IronPython and more!