I'm writing a Node script where I install Python modules using pip. I'd like to activate a virtualenv and then install pip modules in that virtualenv. I could do something like the following:
proc.execFile("virtualenv", { args: "venv" }, function() { proc.execFile("source", { args: "venv/bin/activate" }, function() { proc.execFile("pip", { args: ["install", "myPipModule"]}, function() { // do stuff }); }); });
The issue with this is that it would lose the context of my virtualenv and so wouldn't install the modules where I want them. How can I keep the context of my virtualenv in my Node script so pip install
puts modules in the right place?
Note: Similar to this question for Python but I'm using Node.