RustPython 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
RustPython 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
RustPython 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT
开发语言 Rust 查看源码 »
操作系统 跨平台
软件类型 开源软件
所属分类 开发工具编译器
开源组织
地区 不详
投 递 者 Alias_Travis
适用人群 未知
收录时间 2021-02-01

软件简介

RustPython 是一个由 Rust 编写的 Python 3 解释器。RustPython 可以嵌入到 Rust 程序中,使用 Python 作为应用程序的脚本语言,也可以将其编译为 WebAssembly,在浏览器中运行 Python。

用法:

RustPython 需要 Rust 1.43.0 或以上版本,可以使用以下命令检查 Rust 的版本:

rustc --version

如果想更新至最新版可以使用以下命令:

rustup update stable

要在本地构建 RustPython,可执行以下操作:

$ git clone https://github.com/RustPython/RustPython
$ cd RustPython
  # if you're on windows:
$ powershell scripts\symlinks-to-hardlinks.ps1
  # --release is needed (at least on windows) to prevent stack overflow
$ cargo run --release demo.py
Hello, RustPython!

或使用交互式 shell:

$ cargo run --release
Welcome to rustpython
>>>>> 2+2
4

还可以使用以下命令安装和运行 RustPython:

$ cargo install rustpython
$ rustpython
Welcome to the magnificent Rust Python interpreter
>>>>>

或通过conda包管理器:

$ conda install rustpython -c conda-forge
$ rustpython

WASI:

可以使用以下命令将 RustPython 编译为独立的 WebAssembly WASI 模块,以便可以在任何地方运行它。

$ wapm install rustpython
$ wapm run rustpython
>>>>> 2 + 2
4

构建 WASI 文件

使用以下方法构建 WebAssembly WASI 文件:

cargo build --release --target wasm32-wasi --features="freeze-stdlib"
展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击加入讨论🔥(1) 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
1 评论
24 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部