Simon

Python Venv

開發程式設計v1.2.0
作者:Simon更新於 2026-05-17共 4 個版本 · 最新版本釋出於 2026-03-13python-venv@clawhub_cikichen/python-venv
指令碼工具

據 AlphaMoat 統計,截至 2026-09,Python Venv 累計下載 1,728 次、獲 0 個星標,在全部 5,078 個 AI 技能中排名第 4,628 位,在「開發程式設計」分類(577 個)中排名第 547 位。

累計安裝
150
累計下載
1728
星標
-
全站排名
#4,628
全站前 92% · 「開發程式設計」前 95%
平台累計安裝累計下載星標評論
ClawHub ↗371330--
SkillHub ↗1501728-—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

該技能根據 lock 檔案、專案配置和現有環境推薦 uv、pip、conda、venv 等方案,並主張優先複用現有環境。建立環境、安裝依賴或刪除既有 .venv 都會改變工作區,應先確認具體範圍;遠端安裝指令碼需獨立核實來源與內容。生成的建議是環境管理指引,執行前應檢查專案依賴和團隊規範。 選擇管理工具前應核對已安裝工具和專案規範。

資料釋出於 2026-10-29

可以用來做什麼

  • 識別專案已有的 Python 環境和依賴配置
  • 比較複用現有環境或建立新環境的方案
  • 為已確認的依賴安裝步驟整理安全檢查清單

什麼時候用

  • 需要為 Python 專案選擇依賴管理工具時
  • 可以先只讀檢查專案檔案,並在建立、安裝或刪除前取得確認時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

只檢查專案檔案並提出複用現有 Python 環境的建議;不要建立環境、安裝依賴、刪除檔案或執行遠端安裝指令碼。

月度資料趨勢

累計下載1728
208102518412026-03 · 累計下載 3212026-05 · 累計下載 8582026-06 · 累計下載 10172026-07 · 累計下載 12242026-08 · 累計下載 14052026-09 · 累計下載 172826-0326-09
星標-
0112026-03 · 星標 -2026-05 · 星標 -2026-06 · 星標 -2026-07 · 星標 -2026-08 · 星標 -2026-09 · 星標 -26-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-091728—-
2026-081405+14.8%-
2026-071224+20.4%-
2026-061017+18.5%-
2026-05858—-
2026-03321—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

5.3 KB · ClawHub v1.2.0
---
name: python-venv
description: "Python environment management skill. Automatically detect project type and existing environments, recommend based on popularity. Minimize interruptions, only ask when necessary."
---

# Python Environment Management Skill

## Core Principles

1. **Reuse Existing Environments** - Don't recreate, reuse existing virtual environments
展開全部(共 207 行)
2. **Use Project-Type Decision** - Auto-select based on lock files
3. **Recommend by Popularity** - uv > pip > conda > venv
4. **Minimize Interruption** - Only ask when necessary

---

## Tool Popularity Ranking

| Priority | Tool | Best For |
|----------|------|----------|
| 🥇 | uv | New projects, fast installs |
| 🥈 | pip | Compatibility first |
| 🥉 | conda | Data science, specific versions |
| 4 | venv | Built-in, no extra install |
| 5 | poetry | Existing poetry.lock |
| 6 | pipenv | Existing Pipfile (declining) |

---

## Decision Flow

```
┌─────────────────────────────────────┐
│  Detect project dependency files     │
└─────────────────────────────────────┘
              ↓
    ┌─────────┴─────────┐
    ↓                   ↓
  Clear decision       Unclear
    ↓                   ↓
  Use directly     Detect existing env
                        ↓
                  ┌─────┴─────┐
                  ↓           ↓
              Has env        No env
                  ↓           ↓
              Reuse      Assess complexity
                            ↓
                  ┌─────────┴─────────┐
                  ↓                   ↓
              Simple task       Needs deps
                  ↓                   ↓
            System Python      Recommend uv/conda
```

---

## 1. Clear Decisions (Execute Directly, No Ask)

When these files are detected, use the corresponding tool directly:

| Detected File | Execute |
|--------------|---------|
| `uv.lock` exists | `uv sync` or `uv pip install -r requirements.txt` |
| `poetry.lock` exists | `poetry install` |
| `environment.yml` exists | `conda env create -f environment.yml` |
| `Pipfile.lock` exists | `pipenv install` |

---

## 2. Detect Existing Environments (Reuse First)

```bash
# Priority: uv venv > conda > venv

# 2.1 Detect uv virtual environment
ls -la .venv/ 2>/dev/null && uv pip list 2>/dev/null | head -3

# 2.2 Detect conda environment
conda info --envs 2>/dev/null | grep "*" || echo $CONDA_PREFIX

# 2.3 Detect standard venv
ls -la venv/ .venv/ env/ 2>/dev/null

# 2.4 If exists → Reuse (activate and run commands)
```

**Reuse Example:**
```
Detected existing .venv/ directory
→ Activate: source .venv/bin/activate
→ Run: uv pip install <package>
```

---

## 3. When Unclear (Assess Complexity)

| Scenario | Action |
|----------|--------|
| Stdlib only, no 3rd party | System Python (python3) |
| Simple pip install test | System Python (temp) |
| Has requirements.txt | Recommend uv > pip > venv |
| Has pyproject.toml | Recommend uv > pip |
| Multi-file project, needs isolation | Recommend uv |

---

## 4. When to Ask User (Only These Cases)

✅ **Ask:**
1. Empty project + first dependency install → Ask which tool
2. Both requirements.txt + pyproject.toml → Ask which to use
3. User explicitly wants different tool → e.g., "I want conda"

❌ **Don't Ask:**
- Has uv.lock but user didn't specify
- Has .venv/ directory
- Regular pip install task

---

## 5. Recommended Tool (No Clear Directive)

```
First: uv
  ├── uv venv (create)
  ├── uv pip install (install)
  └── uv sync (sync)

Backup: pip
  ├── python3 -m venv .venv
  └── pip install

Special: conda
  ├── conda create -n envname python=x.x
  └── conda env create
```

---

## Detection Commands

```bash
# Check available tools
which uv
which conda
which pip
which python3

# Check project files
ls -la *.lock pyproject.toml requirements.txt environment.yml Pipfile 2>/dev/null

# Check existing environments
ls -la .venv/ venv/ env/ 2>/dev/null
conda info --envs 2>/dev/null

# Check current environment
echo $VIRTUAL_ENV
echo $CONDA_PREFIX
```

---

## Interaction Examples (Only When Needed)

```
🔍 Detection result:
- Project file: pyproject.toml
- Existing env: None
- Recommended: uv (fastest)

Running: uv pip install <package>
```

```
🔍 Detection result:
- Project file: requirements.txt
- Existing env: None
- Recommended: uv

Available options:
1) uv (recommended) - faster
2) pip - better compatibility
3) venv - uses stdlib
4) conda - if specific version needed

Enter option or press Enter to use recommended:
```

---

## Quick Command Reference

| Action | uv | pip | conda | venv |
|--------|-----|-----|-------|------|
| Create env | `uv venv` | - | `conda create` | `python3 -m venv` |
| Install pkg | `uv pip install` | `pip install` | `conda install` | `pip install` |
| Install deps | `uv sync` | `pip install -r` | `conda env create` | `pip install -r` |
| Activate | (auto) | (auto) | `conda activate` | `source venv/bin/activate` |

---

## Core Principle

**"Do more, ask less"** - Execute directly when you can determine, only ask when truly unclear.

「開發程式設計」分類下的熱門技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。