python -m to run module

with No Comments

I just learned that to run a python module from the terminal, the command line is:  python -m <name_of_module>

I needed to learn this command because while I was grading for my python course, I had to run the module through an outside terminal because I had just reinstalled Anaconda-Navigator and Spyder and the graph that is supposed to be plot after running the module was not showing up because it was hidden, so I ran it on terminal to make sure it wasn’t the student’s code that broke.  Beforehand we always ran the modules with run -m <name_of_module> but when I tried those commands in the Mac terminal it didn’t work. I also was confused what -m meant before, but now I understand it means to run a python module!

Leave a Reply