title: How to specify which version of python to use in npm python-shell node.js
body: <p>I want to invoke a python script in a js file using python-shell. However the script requires python3 and py2 is always used, while my local development has both py2 and 3 installed. How do i specify it to use python3 instead? </p>
  
  <pre><code>app.get('/run_py', (req, res)=&gt;{
      var myPythonScriptPath = 'script.py';
  
      // Use python shell
      var PythonShell = require('python-shell');
      var pyshell = new PythonShell("pyscripts/test.py");
  
      pyshell.on('message', function (message) {
          // received a message sent from the Python script (a simple "print" statement)
          console.log(message);
      });
  
      // end the input stream and allow the process to exit
      pyshell.end(function (err) {
          if (err){
              throw err;
          };
  
          //console.log('finished');
      });
  });
  </code></pre>
  
  <p>My py script looks like:</p>
  
  <pre><code>import sys
  if sys.version_info[0] &lt; 3:
      raise Exception("Must be using Python 3")
  
  print('running test.py')
  print (sys.version_info[0])
  </code></pre>
  
  <p>It always uses python 2.7 when running locally.</p>
  
  <p>Moreover, when I push my code to heroku server which use python 3.6 as default. The scripts runs perfectly...</p>
  
  <p>Any insights? please?</p>
  
  <p>EDIT: I saw you can specify the python path in the PythonShell.run as a parameter.. But what if different platforms say heroku and my local machine has different path to python?</p>