← 返回
未分类 中文

Python Support

Python language support for OpenClaw agents. Provides environment setup, dependency management, linting, testing, and best practices for Python code executio...
OpenClaw代理的Python语言支持,提供环境配置、依赖管理、代码检查、测试及Python代码执行最佳实践。
terrycarter1985
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 642
下载
💾 0
安装
1
版本
#latest

概述

Python Support

Quick Start

Use this skill for all Python-related operations in OpenClaw.

Environment Check

Verify Python environment:

python3 --version
pip3 --list
which python3

Running Scripts

Always use absolute paths and specify Python interpreter explicitly:

python3 /path/to/script.py

Dependency Management

Install packages safely:

pip3 install --quiet package-name

For one-off scripts requiring dependencies, use inline installation with verification:

import subprocess
import sys

def ensure_package(package):
    try:
        __import__(package)
    except ImportError:
        subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", package])

Best Practices

  1. Shebang: Use #!/usr/bin/env python3 for executable scripts
  2. Error handling: Always include try/except blocks for external operations
  3. Encoding: Specify encoding="utf-8" for all file operations
  4. Paths: Use pathlib.Path for cross-platform path handling
  5. Output: Prefer JSON or machine-readable formats for structured output

References

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-01 16:17 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Stock Alert Workflow

terrycarter1985
使用 Yahoo Finance 数据分析股票和加密货币,支持投资组合管理(创建、添加、移除资产),以及按市值排名前 20 的加密货币分析。
★ 0 📥 571

Communication Assistant

terrycarter1985
通过 himalaya 发送邮件、通过 BlueBubbles 发送 iMessage,向收件人广播 Markdown 格式通知。
★ 0 📥 560

Stock Price Alert

terrycarter1985
股价异动实时提醒,支持行情接口、邮件和Sonos语音播报
★ 0 📥 677