<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          RustPython基于 Rust 的 Python 解釋器

          聯(lián)合創(chuàng)作 · 2023-10-02 00:53

          RustPython 是一個(gè)由 Rust 編寫的 Python 3 解釋器。RustPython 可以嵌入到 Rust 程序中,使用 Python 作為應(yīng)用程序的腳本語(yǔ)言,也可以將其編譯為 WebAssembly,在瀏覽器中運(yùn)行 Python。

          用法:

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

          rustc --version

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

          rustup update stable

          要在本地構(gòu)建 RustPython,可執(zhí)行以下操作:

          $ 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

          還可以使用以下命令安裝和運(yùn)行 RustPython:

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

          或通過(guò)conda包管理器:

          $ conda install rustpython -c conda-forge
          $ rustpython
          

          WASI:

          可以使用以下命令將 RustPython 編譯為獨(dú)立的 WebAssembly WASI 模塊,以便可以在任何地方運(yùn)行它。

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

          構(gòu)建 WASI 文件

          使用以下方法構(gòu)建 WebAssembly WASI 文件:

          cargo build --release --target wasm32-wasi --features="freeze-stdlib"
          瀏覽 38
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  欧美精品手机在线观看 | 思思热在线视频免费观看 | 欧美午夜福利在线观看 | 亚洲乱码中文字幕 | 男女激烈啪啪网站 |