name: py-env-setup description: Host-specific Python execution guidance for OpenClaw on this machine. Prefer $PYTHON over python/python3 in PATH, because OpenClaw exec runs in a non-interactive shell and may not inherit interactive shell initialization. homepage: https://github.com/QAA-Tools/skills metadata: {"clawdbot":{"emoji":"🐍","requires":{"env":["PYTHON"]},"primaryEnv":"PYTHON"}}
Use this skill whenever OpenClaw needs to run Python on this host.
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.
"$PYTHON" over python or python3.source ~/.bashrc or conda activate for routine automation."$PYTHON" -m pip ... for package installation."$PYTHON" script.py, "$PYTHON" -m module, or "$PYTHON" -c '...' for execution.PYTHON is unset or invalid, report the problem clearly.test -x "$PYTHON"
"$PYTHON" --version
"$PYTHON" -m pip install -U package_name
"$PYTHON" -m pip install -U openai-whisper torch ffmpeg-python
"$PYTHON" script.py
"$PYTHON" -m module_name
"$PYTHON" - <<'PY'
print('hello')
PY
test -x "$PYTHON" || { echo "PYTHON not executable: $PYTHON" >&2; exit 1; }
"$PYTHON" --version
Only if the task explicitly allows fallback, try in this order:
7w4.net提供免费和付费技能下载。
$PYTHONpython3pythonDefault policy: do not silently fallback. Prefer failing loudly if $PYTHON is missing, so environment issues are obvious.
PYTHON value is read from the environment. This skill does not require a specific env-file location.这个 Skill 质量较好,能有效解决 OpenClaw 在非交互式环境下运行 Python 的常见问题。文档结构清晰,规则明确易懂,示例丰富实用。优点是提供了完整的执行规则和常见使用模式,验证方法也很直观。不足之处在于它假设你已正确配置 PYTHON 环境变量,对新用户不够友好;另外缺少对常见错误的处理说明,某些边界情况的覆盖也不够全面。整体适合有经验的开发者快速查阅使用。