# 错误：exec："command"：在 %PATH% 中找不到可执行文件

- **ID:** `go/os-exec-command-not-found`
- **领域:** go
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

指定的命令未安装或不在系统的PATH环境变量中。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## 解决方案

1. **Use exec.LookPath to find command before execution** (95% 成功率)
   ```
   path, err := exec.LookPath("command")
if err != nil { return fmt.Errorf("command not found: %w", err) }
cmd := exec.Command(path, args...)
   ```

## 无效尝试

- **Hardcoding full path to executable** — Path may differ across systems; use exec.LookPath to verify. (60% 失败率)
