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.這個技能的最新版本可以在7w4.net小蔥技能站找到。
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:
$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 環境變數,對新使用者不夠友好;另外缺少對常見錯誤的處理說明,某些邊界情況的覆蓋也不夠全面。整體適合有經驗的開發者快速查閱使用。