我最近一直在阅读关于asm.js和WebAssembly:
http://ejohn.org/blog/asmjs-javascript-compile-target/
https://brendaneich.com/2015/06/from-asm-js-to-webassembly/
我仍然对以下几点感到困惑:
我看过Compiling Python to WebAssembly及其各种答案、各种项目(EmPython、EmCPython、cpython-emscripten、Pyodide 等),但大多数时候,它需要重新编译或使用 Docker 等。
有没有办法在浏览器中使用 Python(使用 WebAssembly),使其工作方式如下:
您只需将foo.js、foo.wasm、index.html或类似的即用型文件放在一个目录中
你main.py在目录下放一个文件, WebAssembly Python解释index.html器会在我们在浏览器中打开时自动启动,直接在浏览器中显示Python stdout
您可以通过简单地添加 .py 文件来导入标准 Python 模块 main.py
例子:
pythoninbrowser.js
pythoninbrowser.wasm
index.html
main.py    --> containing "import bs4"
bs4/
    __init__.py
    ...all the rest of the BeautifulSoup module...
另请参阅此问题。
有很多语言可以编译成 Wasm。使用 C 或 Rust 等语言编写比 Python 有性能提升吗?或者因为它被编译为 Wasm ,所以一切都一样吗?