Fix Windows Python spawning
This commit is contained in:
@@ -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
|
||||
|
||||
10
README.md
10
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` 를 넣으면 됩니다.
|
||||
|
||||
## 설계 메모
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -10,6 +10,7 @@ async function run(command: string, args: string[], extraEnv?: NodeJS.ProcessEnv
|
||||
await new Promise<void>((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<voi
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const child = spawn(pythonBin, ["-m", "pip", "--version"], {
|
||||
stdio: "ignore",
|
||||
shell: process.platform === "win32",
|
||||
env,
|
||||
});
|
||||
child.on("exit", (code) => {
|
||||
|
||||
Reference in New Issue
Block a user