How to run Python 3 with Nodemon on Mac

Last updated on October 23, 2020 A Goodman Loading... Post a comment

Python 2 is pre-installed in macOS, thus when you try to run your Python code with Nodemon like this:

nodemon [your-file.py]

then Python 2 starts its job. If you want to use Python 3 instead, run this command:

nodemon --exec python3 [your-file.py]

Example:

nodemon --exec python3 index.py 

Some output in the console:

nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: py,json
[nodemon] starting `python3 index.py`
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Articles