Is it possible to run native python code in chrome? Is it possible to run native python code in chrome? google-chrome google-chrome

Is it possible to run native python code in chrome?


Python is a programming language, you can't run native code of a programming language. You can however, run programs written in python in the browser.

So can I run python code in the browser or not?

Update June 2013: The Brython project is now available letting you run Python 3 code in your browser. You can check it out at http://www.brython.info/ .

You can use run LLVM in JavaScript using ECMAScripten. This means you can compile c-python from C to JavaScript and just run JS in the browser. The link to the ECMAScripten wiki provides more details on how to do that.

(Here is a live demo of a python REPL running in the browser)

There also exist python 2 implementations that work in the browser.

But should I?

Probably not, JavaScript and python are similar in many things, both are dynamic, both are compact and both are clever. If you know python you can learn JavaScript very quickly.

If you like python's syntax, you might want to consider CoffeeScript which has similar syntax to Python (and somewhat to Ruby) and compiles to JavaScript transparently.

Solutions that run python in the browser will also tend to be much slower, at least until more browsers will support asm.js (currently only firefox nightly).


I believe you can create a compiler in Javascript, to run simple python code. There are probably some available programs as well that will allow this to be carried out. Although, it is not possible to run python directly through a web browser.