Python Env Setup
v1.0.0Host-specific Python execution guidance for OpenClaw on this machine. Prefer $PYTHON over python/python3 in PATH, because OpenClaw exec runs in a non-interac...
Like a lobster shell, security has layers — review code before you run it.
Runtime requirements
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
- Prefer
"$PYTHON"overpythonorpython3. - Do not rely on
source ~/.bashrcorconda activatefor routine automation. - Before using Python, verify it exists and is executable.
- Use
"$PYTHON" -m pip ...for package installation. - Use
"$PYTHON" script.py,"$PYTHON" -m module, or"$PYTHON" -c '...'for execution. - Apply this rule to all Python-related commands, not just pip.
- If
PYTHONis 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:
$PYTHONpython3python
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
PYTHONvalue is read from the environment. This skill does not require a specific env-file location.
Comments
Loading comments...
