从JavaScript调用Python [英] Calling Python from JavaScript
问题描述
有没有一种从JavaScript调用Python库的简单方法?特别是从Firefox扩展的内部。
Is there a simple way to call Python libraries from JavaScript? Especially from the inside of a Firefox extension.
编译纯Python库的一个很好的选择也很棒。我查看了睡衣,但它似乎只为Python提供部分支持。
A good option to compile a pure Python library would also be great. I looked at Pyjamas, but it seems to offer only partial support for Python.
推荐答案
你需要一个内置python支持的浏览器(但这不是标准,因此它会破坏目的使用webapp - 如果你需要一个特殊的客户端,你可以更好地使用经典的gui),或者将Python翻译成Javascript的方法;当时有三种选择:
You would either need a browser with builtin python support (but this is not a "standard", hence it would defeat the purpose of using a webapp - if you need a special client, you can better use a classic gui), or a way to translate Python to Javascript; there three options for this at the time:
- 睡衣
- Skulpt
- PyPy
相反,如果只是想要扩展Firefox,请选择看看这个:
http://pyxpcomext.mozdev.org/
On the contrary, if you just want to extend Firefox, take a look at this: http://pyxpcomext.mozdev.org/
这篇关于从JavaScript调用Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!