Use this skill to keep Python workflows reproducible and low-risk across local/dev shells.
.venv) over global installs.python3 -m pip ... to avoid interpreter and pip mismatch.requirements*.txt, pyproject.toml).python3 --version
python3 -c "import sys; print(sys.executable)"
{baseDir}/scripts/python_env_tool.py doctor
{baseDir}/scripts/python_env_tool.py bootstrap --venv .venv --requirements requirements.txt
pyproject.toml exists):{baseDir}/scripts/python_env_tool.py install --venv .venv --editable
.venv/bin/python -m pytest -q
.venv/bin/python -m pip list --outdated
# Install specific packages into venv
{baseDir}/scripts/python_env_tool.py install --venv .venv --package requests --package pydantic
# Install from requirements file
{baseDir}/scripts/python_env_tool.py install --venv .venv --requirements requirements-dev.txt
# Recreate corrupted venv from scratch
{baseDir}/scripts/python_env_tool.py bootstrap --venv .venv --recreate --requirements requirements.txt
ModuleNotFoundError: verify command is run via .venv/bin/python, then reinstall deps.externally-managed-environment: stop global install attempts; use venv.pip setuptools wheel, then retry.sys.executable before fixes.Use the helper for repeatable environment setup and diagnosis:
{baseDir}/scripts/python_env_tool.py --help
{baseDir}/scripts/python_env_tool.py doctor
共 1 个版本