Skip to main content

Run your first Python program

Make a small program print Hello from Phoenix Code! You'll write it in the editor and run it in the terminal at the bottom of the window.

Before you start: use the Phoenix Code desktop app. Community (free) and Pro use the same steps. You'll also need Python 3, which you can install below.

Install Python​

Choose your operating system. If you already have Python 3, skip the installation steps and run the version check for your system.

  1. Open Python's Windows downloads page and choose Latest Python install manager.
  2. On its release page, click Download Installer (MSIX).
  3. Open the downloaded file, click Install, and finish the setup.
  4. Open the Windows Start menu, search for PowerShell, and open it.
  5. Type this command and press Enter to install Python 3:
py install 3
  1. Wait for the installation to finish. Then check the version:
py --version

For setup problems, see Python's Windows installation guide.

You should see a version beginning with Python 3. After installing Python, close and reopen Phoenix Code so its terminal can find the new installation. You're ready to create your program.

1. Open a folder for your program​

  1. Create a folder on your computer named python-practice.
  2. In Phoenix Code, click Open Folder in the Start Project dialog.
  3. Choose python-practice.

2. Create your Python file​

  1. Choose File > New.
  2. Type this line in the empty editor:
print("Hello from Phoenix Code!")
  1. Choose File > Save.
  2. Save it as hello.py inside python-practice.

You should see hello.py in the file list on the left. Make sure it ends in .py, not .py.txt.

3. Open the terminal​

  1. Right-click hello.py in the file list.
  2. Choose Open In > Integrated Terminal.

The Open In menu with Integrated Terminal selected

A terminal opens in the same folder as your file. Click inside it so you're ready to type a command.

4. Run your program​

Choose your operating system below. Type each command in the terminal and press Enter.

First, check that Python is available:

py --version

You should see a version beginning with Python 3. Then run your file:

py hello.py

You should see this in the terminal:

Hello from Phoenix Code!

If the version command isn't found, use the first help item below before continuing.

5. Make it say something else​

  1. Change the message between the quotes in hello.py:
print("I ran my first Python program!")
  1. Save the file.
  2. Click in the terminal and run the same command again.

You should see your new message. Python runs the saved file, so remember to save each change before running it.

Need help?​

My computer says py or python3 was not found

Follow Install Python for your operating system, then close and reopen Phoenix Code so it can pick up the installation. Open a new integrated terminal and try the version command again.

Some installations use the command python. Try python --version. If it reports Python 3, use python hello.py to run your file.

See Python's interpreter guide for installation-specific command names.

I get “can't open file” or “No such file or directory”

Check that the file is saved as hello.py. Right-click that file in Phoenix Code and open a new Integrated Terminal from its Open In menu. Then run the command again.

This puts the terminal in the correct folder, including if you switched projects earlier.

The terminal shows >>>

You're inside Python's interactive prompt. Type exit() and press Enter. Then run the command with the filename, such as py hello.py or python3 hello.py.

Code hints work, but I can't run the program

Python code intelligence provides editing help. Running your program also needs a Python interpreter installed on your computer.

Read your program's output in the terminal. Live Preview doesn't run a Python script.

I'm using Phoenix Code in a browser

The integrated terminal is a desktop feature. You can still save hello.py to a local folder and run it from your computer's terminal with the same Python commands. Or open that folder in the desktop app to follow this guide.

Next, try the Terminal guide to learn about terminal tabs and project switching.