Your first Python program: Hello, Anaconda!#

This tutorial will take you through a short programming exercise, using Navigator and then a command line interface (CLI).

Launching development environment applications from Navigator#

We will first go through some short exercises using Anaconda Navigator to launch two different integrated development environments (IDEs), Spyder and Jupyter Notebook.

Open Navigator#

Choose the instructions for your operating system:

Run Python in Spyder#

More of a visual learner? Sign in to Anaconda Cloud to follow along with our Create a simple Python program in Spyder course under Hands-on practice instead!

  1. On Navigator’s Home tab, in the applications pane on the right, launch the Spyder IDE from its tile.
Note If Spyder is not installed in your current environment, click Install to install it.

  • Spyder opens with a temp.py file open on the left.
  • In temp.py , delete any placeholder text and add print("Hello, Anaconda") to line 1.
  • In the top menu, click File >Save As and name your new program hello.py .
  • Run your new program by clicking the triangle Run button.
  • Click Run in the run settings dialog that appears.
  • You can see your program’s output in the bottom right console pane.
  • Close Spyder.
  • Run Python in a Jupyter Notebook#

    More of a visual learner? Sign in to Anaconda Cloud to follow along with our Jupyter Notebook and JupyterLab courses under Integrated development environment (IDE) and Jupyter Notebook instead!

    1. On Navigator’s Home tab, in the applications pane on the right, launch Jupyter Notebook from its tile.
    Note If Jupyter Notebook is not installed in your current environment, click Install to install it.

  • Click the New dropdown.
  • Create a new notebook with the Python version you installed.
  • Click your new notebook’s “Untitled” name to rename it. You can name it to whatever you’d like, but for this example we’ll use “MyFirstAnacondaNotebook”.
  • In the first line of the Notebook, add print("Hello, Anaconda") .
  • Save your notebook.
  • Run your new program by clicking Run or selecting Cell >Run All from the top menu.
  • Close the browser tab containing Jupyter Notebook.
  • Close Navigator#

    From here, you can close Navigator and move on to the conda CLI tutorial below:

    Write a Python program using a CLI#

    Open your CLI#

    There are many command line interface (CLI) options available to you. Anaconda recommends that Windows users use Anaconda Prompt, while macOS and Linux users are welcome to use whatever CLI they are comfortable with.

    macOS and Linux users - If you aren’t seeing (base) in your chosen CLI, you need to either initialize conda or activate your base environment. See either the macOS or Linux install instructions for more information.

    Start Python#

    In your CLI, type python and press Enter or return.

    A >>> appears in your CLI and means you are in the Python interpreter, which allows you to run simple scripts right from the command line.

    Write a Python program#

    At the >>> , type print("Hello, Anaconda!") and press Enter or return.

    When you press Enter or return, your program runs. The words “Hello, Anaconda!” print to the screen. You’re programming in Python!

    Exit Python#

    Optional: Launch Spyder or Jupyter Notebook from the command line#

    You can run the same exercises in Run Python in Spyder and Run Python in a Jupyter Notebook after opening Spyder and Jupyter Notebook from your CLI.