Loading...

Install Python

The last page only read print. This page puts Python 3 on the computer and runs those two lines as a file. Done looks like this: the version line starts with Python 3, and the file prints lida, then tea.

Python 3, from python.org

Get Python 3 from python.org. Python 2 is finished, so do not install it. On Linux, the system package python3 is the same choice when that computer does not install software from python.org. This page does not add a web framework.

The terminal has to see the command

On Windows, turn on Add python.exe to PATH in the installer, then open a new terminal. The old window still has the old PATH. Type python --version. A good answer starts with Python 3. The patch number can differ.

On macOS and many Linux systems the working command is python3 --version. Keep the command that prints Python 3. If the terminal says the command is not found, Python is not on PATH yet. The quotes inside print are not the cause.

Three commands, three jobs

The version check, the file, and the bare prompt do different work. Only the middle command prints lida and tea.

📊 Three commands

Command What you get
python --version a line that starts with Python 3
python tea.py lida, then tea, on two lines
python the prompt >>>, and the file does not run

Save the two lines as tea.py

Put the file in a folder you can open in the terminal. The name is tea.py. Do not name it python.py. That name hides part of Python itself.

tea.py

python
print("lida")
print("tea")

Move the terminal into the folder that contains tea.py, then run python tea.py. The output is two lines. First lida. Then tea. The quotes stay in the file and are not printed. If python was not the command that printed Python 3, run the file with the one that did: python3 tea.py, or py tea.py when Windows gives you the py launcher. The file stays the same.

Stuck at >>>

python with no file opens a prompt that looks like >>>. That is not tea.py running. Leave it with exit() and run the file.

Wrong folder

If the terminal cannot find tea.py, the version can still be fine. You are in another folder. Go to the folder that holds the file, then run it again.

After the two lines work

This page does not create a name, does not read what you type, and does not open a data file. The next page is how a Python line is written. Install is finished when the version starts with Python 3 and tea.py prints the two lines.

Check yourself

  1. python --version starts with Python 3.
  2. tea.py contains print("lida") and then print("tea").
  3. From that folder, the run prints lida, then tea.
  4. A missing command is PATH, not a bad quote.
  5. means the prompt is open. Run the file instead.

Misses

  • Installing Python 2
  • Leaving PATH off on Windows and keeping the old terminal
  • Naming the file python.py
  • Running in the wrong folder and blaming print
  • Reading the output as lida / tea
  • Treating >>> as the program output

Keep

  • Python 3 comes from python.org, or from the system package python3.
  • python --version should start with Python 3.
  • tea.py prints lida, then tea, each on its own line.
  • Command not found means this terminal cannot see Python.
  • The next page is how lines are written.

🧠 Test Your Knowledge

Ready to Start

Test Your Knowledge

Challenge yourself with this interactive quiz and see how well you understand the topic

❓
4
Questions
🎯
70%
To Pass
♾️
∞
Time
🔄
∞
Attempts

📝 Instructions

  • Read each question carefully
  • Select the best answer for each question
  • You can retake the quiz as many times as you want
  • Your progress will be shown at the top