Getting started with Python takes three quick steps: install Python 3, verify your terminal command, and run a .py file. Most macOS and Linux systems ship with Python preinstalled, while Windows users install it from python.org.
On Windows, check the Add Python to PATH box in the installer before clicking install. Skipping that checkbox prevents your terminal from finding the python command later.
Open your terminal or PowerShell window and check the installed version. Run one of the commands below depending on your operating system.
# Windows (PowerShell or Command Prompt)
python --version
# macOS and Linux
python3 --version
If you see Python 3.11.x or newer, your environment is ready. You can also launch the interactive shell (REPL) by typing python with no filename.
The interactive shell runs one expression at a time, which helps you test small snippets quickly. For real programs, save your code in a file ending with .py and run it from your terminal.
# Save this file as greet_user.py
user_name = "Samira"
tasks_today = 4
print(f"Hello, {user_name}. You have {tasks_today} tasks today.")
Execute the script from the same folder:
python greet_user.py
python greet_user.py belong in your system terminal, not inside the >>> Python prompt..py file before re-running it in the terminal.No such file or directory, run pwd or cd to move into the folder holding your script.VS Code with the official Microsoft Python extension works well for beginners and professionals. PyCharm Community Edition is another solid option with built-in debugging.
Type exit() and press Enter, or press Ctrl+Z then Enter on Windows (Ctrl+D on macOS and Linux).
For single learning scripts, the global Python install works fine. Once you install third-party packages with pip, create a project venv to isolate dependencies.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Experiment with the code from this lesson in our interactive playground.