I've wanted to try atom as a new IDE for python on macOS, and I've found people usually use the command-line to run scripts with python3 myprogram.py
on unix machines.
That works for me, but in some cases I want to test a variable's value without having to add plenty of print()
lines in my code, the same way I would be able to with IDLE's or replit's console, without the command-line going back to zsh.
Example with replit
Example with command line
CodePudding user response:
Just type python3 in your terminal and the python console will pop out
CodePudding user response:
You're almost-certainly looking for PDB The Python Debugger: https://docs.python.org/3/library/pdb.html
Run your program as python3 -m pdb myscript.py
Use b
to set breakpoints (so you can inspect your program state there or get into libraries), c
to run up to that point (continue), and ?
to explore commands .. this will allow you to inspect the live state of your program wherever you breakpoint or continue to
CodePudding user response:
Use python3
If it doesn't work you probably don't have Python 3 installed. I recommend installing Homebrew on your macOS. https://brew.sh/
Then you can easily install Python 3 using this command: brew install python3
And additionally if you need pip3 too: brew install python3-pip
Installing packages using brew is almost the same as installing packages on Linux.