SuperAPI AI Directory

venv-manager

Coding & development

View repository

Updated 10-16 08:56

About this skill

Python Virtual Environment Manager

Guidelines and tools for managing Python virtual environments.

When to Use

  • When a skill needs to install Python dependencies
  • When executing Python scripts that require an isolated environment
  • Avoid polluting the global Python environment
  • When multiple projects require different versions of dependencies

Quick Start

# 1. 创建虚拟环境
python scripts/create-venv.py <path> [--python <version>]

# 2. 激活虚拟环境
source scripts/activate-venv.sh <path>
3. Install dependencies

pip install -r requirements.txt


## 工作流程

1. **检查现有虚拟环境**
   - 检查 `.venv/` 或 `venv/` 目录是否存在
   - 检查 `.venv_path` 文件中的路径

2. **创建虚拟环境(如需要)**
   ```bash
   python scripts/create-venv.py <path>
  1. Activate the virtual environment

    source scripts/activate-venv.sh <path>
    # 或使用 Python API
    python scripts/activate-venv.py --activate <path>
    
  2. Execute commands in the virtual environment

    • All pip install commands should be executed after activation
    • All Python scripts should be run after activation
  3. Cleanup (optional)

    python scripts/cleanup-venv.py <path>
    

Reference Files

File Purpose
scripts/create-venv.py Create a new virtual environment
scripts/activate-venv.py Activate the virtual environment (Python API)
scripts/activate-venv.sh Activate the virtual environment (Shell script)
scripts/cleanup-venv.py Clean up/delete the virtual environment
references/venv-guide.md Best practices for virtual environment management
references/common-issues.md Common problem solutions