I am trying to compile python scripts using Node.js. The python scripts include some modules I have installed.
My package manager for python is Anaconda, so I tried to supply the {"shell":"path to anaconda prompt"}
option in :
var exec = require('child_process').exec;
exec('python hello.py',{"shell":"path to anaconda prompt"}, ..callback)
However, I get an error:
{ Error: spawn C:\Users\dream\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)\Anaconda Prompt (Anaconda3) ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
errno: 'ENOENT',
code: 'ENOENT',
syscall:
'spawn C:\\Users\\dream\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Anaconda3 (64-bit)\\Anaconda Prompt (Anaconda3)',
path:
'C:\\Users\\dream\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Anaconda3 (64-bit)\\Anaconda Prompt (Anaconda3)',
spawnargs: [ '/d', '/s', '/c', '"python hello.py"' ],
cmd: 'python hello.py' }
stdout:
stderr:
I suspect that this is because the Anaconda Prompt is just some wierd shortcut that sets up some variables for cmd.exe (which is the location the shortcut points to).
So my questions:
Can I call the anaconda prompt directly with Node.js? Does pip also have a shell?
How do the packagers (pip,anaconda) make modules accessible to python? -> Is this through some environment variables?
Can I prepare cmd.exe for work with python the same way that they do?