diff --git a/.env.example b/.env.example index 31c4063..95d481f 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ OLLAMA_NUM_CTX=4096 LOCAL_AI_VENV_PATH=.local-ai/.venv LOCAL_AI_CACHE_DIR=.local-ai/cache -# Windows면 보통 `py -3` +# Windows면 `python` 또는 `py -3` LOCAL_AI_PYTHON= LOCAL_STT_MODEL=tiny LOCAL_STT_DEVICE=auto diff --git a/README.md b/README.md index fca382c..e60b5c2 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,11 @@ ollama pull qwen3:0.6b bun run setup:local-ai ``` -Windows에서 `python` 에러가 나면 `.env` 에 먼저 이 값을 넣습니다: +Windows에서 Python 실행기는 환경마다 다릅니다. 둘 중 되는 쪽 하나만 넣으면 됩니다: ```env +LOCAL_AI_PYTHON=python +# 또는 LOCAL_AI_PYTHON=py -3 ``` @@ -98,7 +100,7 @@ Discord 모드에서만 필수: - `LOCAL_AI_PYTHON` - Python 경로 자동 탐지가 안 되면 설정 - 예시: `python` - - Windows 예시: `py -3` + - Windows 예시: `python` 또는 `py -3` - `LOCAL_AUDIO_SOURCE` - 로컬 입력 장치 - Linux는 `pw-record --target`, Windows는 `ffmpeg dshow` 장치 이름 @@ -129,7 +131,7 @@ OLLAMA_MODEL=qwen3:1.7b 1. `bun install` 2. `ollama pull qwen3:0.6b` -3. Windows면 `.env` 에 `LOCAL_AI_PYTHON=py -3` 추가 +3. Windows면 `.env` 에 `LOCAL_AI_PYTHON=python` 또는 `LOCAL_AI_PYTHON=py -3` 추가 4. `bun run setup:local-ai` 5. `bun run devices` 6. `.env` 에 `LOCAL_AUDIO_SOURCE` 설정 @@ -139,7 +141,7 @@ OLLAMA_MODEL=qwen3:1.7b - `bun run devices` 와 Windows 로컬 녹음은 `ffmpeg`가 필요합니다. - 출력 장치 직접 선택은 아직 미구현이라 시스템 기본 출력 장치로 재생됩니다. -- Python 탐지가 안 되면 `.env` 에 `LOCAL_AI_PYTHON=py -3` 를 넣으면 됩니다. +- Python 탐지가 안 되면 `.env` 에 `LOCAL_AI_PYTHON=python` 또는 `LOCAL_AI_PYTHON=py -3` 를 넣으면 됩니다. ## 설계 메모 diff --git a/src/python-runtime.ts b/src/python-runtime.ts index cab3af9..ab40499 100644 --- a/src/python-runtime.ts +++ b/src/python-runtime.ts @@ -17,6 +17,7 @@ function splitCommandSpec(spec: string): string[] { function canRun(command: string, args: string[]): boolean { const result = spawnSync(command, [...args, "--version"], { encoding: "utf8", + shell: process.platform === "win32", }); return result.error == null && result.status === 0; } diff --git a/src/services/python-json-worker.ts b/src/services/python-json-worker.ts index 5f87dc7..59c69a4 100644 --- a/src/services/python-json-worker.ts +++ b/src/services/python-json-worker.ts @@ -111,6 +111,7 @@ export class PythonJsonWorker { const child = spawn(launch.command, [...launch.args, scriptPath], { stdio: ["pipe", "pipe", "pipe"], + shell: process.platform === "win32", env: { ...process.env, HF_HOME: cachePath, diff --git a/src/setup-local-ai.ts b/src/setup-local-ai.ts index 229ac92..69e1e56 100644 --- a/src/setup-local-ai.ts +++ b/src/setup-local-ai.ts @@ -10,6 +10,7 @@ async function run(command: string, args: string[], extraEnv?: NodeJS.ProcessEnv await new Promise((resolve, reject) => { const child = spawn(command, args, { stdio: "inherit", + shell: process.platform === "win32", env: { ...process.env, ...extraEnv, @@ -31,6 +32,7 @@ async function ensurePip(pythonBin: string, env: NodeJS.ProcessEnv): Promise((resolve, reject) => { const child = spawn(pythonBin, ["-m", "pip", "--version"], { stdio: "ignore", + shell: process.platform === "win32", env, }); child.on("exit", (code) => {