Getting started with Anaconda

Anaconda Distribution contains conda and Anaconda Navigator, as well as Python and hundreds of scientific packages. When you installed Anaconda, you installed all these too. You can try both conda and Navigator to see which is right for you to manage your packages and environments. You can even switch between them, and the work you do with one can be viewed in the other.

Try this simple programming exercise, with Navigator and the command line, to help you decide which approach is right for you.

Your first Python program: Hello, Anaconda!

Use Anaconda Navigator to launch an application. Then, create and run a simple Python program with Spyder and Jupyter Notebook.

Open Navigator

Choose the instructions for your operating system.

Windows

From the Start menu, click the Anaconda Navigator desktop app.

../../../_images/win-navigator2.png

macOS

Open Launchpad, then click the Anaconda Navigator icon.

../../../_images/Navigator_Launchpad_icon.png

Linux

Open a terminal window and type anaconda-navigator.

Run Python in Spyder IDE (integrated development environment)

Tip

Navigator’s Home screen displays several applications for you to choose from. For more information, see links at the bottom of this page.

  1. On Navigator’s Home tab, in the Applications pane on the right, scroll to the Spyder tile and click the Install button to install Spyder.

    Note

    If you already have Spyder installed, you can jump right to the Launch step.

  2. Launch Spyder by clicking Spyder’s Launch button.

  3. In the new file on the left, delete any placeholder text, then type or copy/paste print("Hello Anaconda").

  4. In the top menu, click File - Save As and name your new program hello.py.

  5. Run your new program by clicking the triangle Run button.

  6. You can see your program’s output in the bottom right Console pane.

    ../../../_images/getting-started_Spyder.png

Close Spyder

From Spyder’s top menu bar, select Spyder - Quit Spyder (In macOS, select Python - Quit Spyder).

Run Python in a Jupyter Notebook

  1. On Navigator’s Home tab, in the Applications pane on the right, scroll to the Jupyter Notebook tile and click the Install button to install Jupyter Notebook.

    Note

    If you already have Jupyter Notebook installed, you can jump right to the Launch step.

  2. Launch Jupyter Notebook by clicking Jupyter Notebook’s Launch button.

    This will launch a new browser window (or a new tab) showing the Notebook Dashboard.

    ../../../_images/jupyter-dashboard.png
  3. On the top of the right hand side, there is a dropdown menu labeled “New”. Create a new Notebook with the Python version you installed.

  4. Rename your Notebook. Either click on the current name and edit it or find rename under File in the top menu bar. You can name it to whatever you’d like, but for this example we’ll use MyFirstAnacondaNotebook.

  5. In the first line of the Notebook, type or copy/paste print("Hello Anaconda").

  6. Save your Notebook by either clicking the save and checkpoint icon or select File - Save and Checkpoint in the top menu.

  7. Run your new program by clicking the Run button or selecting Cell - Run All from the top menu.

    ../../../_images/getting-started_Jupyter.png

Close Jupyter Notebook

  1. From Jupyter Notebooks top menu bar, select File - Close and Halt.
  2. Click the Quit button at the upper right of the Notebook Dashboard and close the window or tab.

Close Navigator

From Navigator’s top menu bar, select Anaconda Navigator - Quit Anaconda-Navigator.

Write a Python program using Anaconda Prompt or terminal

Open Anaconda Prompt

Choose the instructions for your operating system.

Windows

From the Start menu, search for and open “Anaconda Prompt”:

../../../_images/win-anaconda-prompt1.png

macOS

Open Launchpad, then click the terminal icon.

Linux

Open a terminal window.

Start Python

At Anaconda Prompt (terminal on Linux or macOS), type python and press Enter.

The >>> means you are in Python.

Write a Python program

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

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

Exit Python

On Windows press CTRL-Z and press Enter. On macOS or Linux type exit() and press Enter.

Optional: Launch Spyder or Jupyter Notebook from the command line

  1. At the Anaconda Prompt (terminal on Linux or macOS), type spyder and press Enter. Spyder should start up just like it did when you launched it from Anaconda Navigator.
  2. Close Spyder the same way you did in the previous exercise.
  3. At the Anaconda Prompt (terminal on Linux or macOS), type jupyter-notebook and press Enter.

Jupyter Notebook should start up just like it did when you launched it from Anaconda Navigator. Close it the same way you did in the previous exercise.