(pythonPath: string)
| 4 | const execAsync = promisify(exec); |
| 5 | |
| 6 | export async function verifyPythonPath(pythonPath: string): Promise<boolean> { |
| 7 | try { |
| 8 | const { stdout, stderr } = await execAsync(`${pythonPath} --version`); |
| 9 | if (stderr) { |
| 10 | throw new Error(stderr) |
| 11 | } |
| 12 | console.log(`Python found: ${stdout}`); |
| 13 | return true; |
| 14 | } catch (error: any) { |
| 15 | throw new Error(`Python not found at ${pythonPath}`); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | // verifyPythonPath("/Users/chenxuejia/comflowy/tmp/python"); |