← 返回
开发者工具 中文

Python Env Setup

Host-specific Python execution guidance for OpenClaw on this machine. Prefer $PYTHON over python/python3 in PATH, because OpenClaw exec runs in a non-interac...
针对本机 OpenClaw 的主机特定 Python 执行指导。在 PATH 中优先使用 $PYTHON 而非 python/python3,因为 OpenClaw exec 运行在非交互环境。
cndaqiang
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 624
下载
💾 57
安装
1
版本
#latest

概述

Python Environment Setup

Use this skill whenever OpenClaw needs to run Python on this host.

Why this exists

On this machine, OpenClaw exec runs in a non-interactive shell.

Interactive shell initialization may be skipped, so python, python3, or conda may be unavailable from PATH even though they work in a normal terminal.

Therefore, prefer the explicit Python entrypoint provided by environment variable PYTHON.

Rules

  1. Prefer "$PYTHON" over python or python3.
  2. Do not rely on source ~/.bashrc or conda activate for routine automation.
  3. Before using Python, verify it exists and is executable.
  4. Use "$PYTHON" -m pip ... for package installation.
  5. Use "$PYTHON" script.py, "$PYTHON" -m module, or "$PYTHON" -c '...' for execution.
  6. Apply this rule to all Python-related commands, not just pip.
  7. If PYTHON is unset or invalid, report the problem clearly.

Validation

test -x "$PYTHON"
"$PYTHON" --version

Common patterns

Install packages

"$PYTHON" -m pip install -U package_name
"$PYTHON" -m pip install -U openai-whisper torch ffmpeg-python

Run a script

"$PYTHON" script.py

Run a module

"$PYTHON" -m module_name

Run inline Python

"$PYTHON" - <<'PY'
print('hello')
PY

Quick guard pattern

test -x "$PYTHON" || { echo "PYTHON not executable: $PYTHON" >&2; exit 1; }
"$PYTHON" --version

Fallback policy

Only if the task explicitly allows fallback, try in this order:

  1. $PYTHON
  2. python3
  3. python

Default policy: do not silently fallback. Prefer failing loudly if $PYTHON is missing, so environment issues are obvious.

Notes

  • This skill is host-specific.
  • It is meant to guide OpenClaw runtime behavior, not teach Python itself.
  • The PYTHON value is read from the environment. This skill does not require a specific env-file location.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 20:53 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 427 📥 118,383
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,925
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,519