Search code examples
python-3.xnodemon

How to run python 3 with nodemon?


I have a simple script in python 3. I want to run with nodemon so that it can start automatically when the file changes. On nodemon npm, I have this code : nodemon --exec "python -v" ./app.py. The issue is that python version 3 is not enforced.

my python file looks like this:

#!/usr/bin/env python3
print "hello world!"

This code is working perfectly, this means Python 3 is not enforced.

How can I use nodemon and make sure it use Python 3 instead of 2?


Solution

  • You can just use this:

    nodemon --exec python3 hello.py
    

    I found the answer here, it works well for me.