# WebPyEditor **Repository Path**: aymwoo/webpyeditor ## Basic Information - **Project Name**: WebPyEditor - **Description**: WebPyEditor — 一个运行在浏览器中的 Python 学习环境。无需安装,打开即用,支持代码编辑、交互式输入、图形可视化,非常适合 Python 编程教学。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-22 - **Last Updated**: 2026-05-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WebPyEditor 基于浏览器的 Python 学习与教学环境。无需安装任何软件,直接在浏览器中编写、运行 Python 代码。 ![Pyodide](https://img.shields.io/badge/Pyodide-WebAssembly-brightgreen) ![Python](https://img.shields.io/badge/Python-3.11-blue) ![License](https://img.shields.io/badge/License-MIT-yellow) ![输入图片说明](screenshot.png) ## 特性 - **浏览器端运行** — 无需安装配置,打开即用 - **Monaco Editor** — 专业级代码编辑器,语法高亮、自动补全 - **交互式输入** — 支持 `input()` 函数 - **图形可视化** — Matplotlib 图表、Turtle 图形 - **预装科学计算库** — pandas, matplotlib, numpy ## 快速开始 ```bash # 克隆仓库 git clone https://gitee.com/aymwoo/webpyeditor.git cd webpyeditor # 启动服务 python -m http.server ``` [http://localhost:8000](http://localhost:8000) ## 功能演示 ### 基本使用 ```python # 交互式输入 name = input("请输入你的名字: ") print(f"你好, {name}!") # 科学计算 import numpy as np arr = np.array([1, 2, 3, 4, 5]) print(f"数组和: {arr.sum()}") ``` ### Turtle 图形 ```python t = jsTurtle t.speed(0) t.penup() t.home() t.pendown() colors = ['#e94560', '#4ecca3', '#ffd369'] for i in range(36): t.forward(100) t.right(170) if i % 6 == 0: t.pencolor(colors[i // 6]) ``` ``` ## 预装库 | 库 | 说明 | |----|------| | pandas | 数据分析 | | matplotlib | 图表绘制 | | numpy | 数值计算 | | micropip | 第三方包安装 | ## 添加新库 使用 `micropip` 安装纯 Python 包(需要有 wheel 文件): ```python import micropip await micropip.install('requests') # 示例:安装 requests 库 ``` **注意**:包含 C 扩展的库(如 numpy、pandas 等已预装的库)无需安装,只有纯 Python 库才能通过 micropip 安装。 ## 操作指南 | 功能 | 操作 | |------|------| | 运行代码 | `Ctrl + Enter` | | 加载文件 | 📂 按钮 | | 保存代码 | 💾 按钮 | | 清空输出 | 清空 按钮 | | 查看图片 | 🖼️ 图片 按钮 | | 查看 Turtle | 🐢 Turtle 按钮 | ## 适用场景 - Python 编程教学 - 编程入门体验 - 快速原型验证 - 在线代码演示 ## 技术栈 - [Pyodide](https://github.com/pyodide/pyodide) — 浏览器中的 Python - [Monaco Editor](https://microsoft.github.io/monaco-editor/) — VS Code 同款编辑器 - [xterm.js](https://xtermjs.org/) — 终端模拟器 ## 浏览器兼容性 现代浏览器(Chrome, Firefox, Safari, Edge) ## License MIT