avatarMartin Thoma

Summary

The web content provides a comprehensive guide on how to start Python development on Windows 10 using Anaconda, detailing installation, running Python through different methods, and tips for further learning.

Abstract

The article "How to start Python Development on Windows 10 with Anaconda" serves as a step-by-step tutorial for beginners to set up a Python development environment on a Windows 10 machine using the Anaconda distribution. It covers the installation of Anaconda, which includes essential tools like the Spyder editor and Jupyter Notebooks. The guide demonstrates three methods to execute Python code: through the Spyder editor, via the terminal (CMD.exe), and within Jupyter notebooks. It also explains how to install additional Python packages using pip, enhancing the capabilities of the Python interpreter. The article emphasizes the versatility of Python in various fields such as web development, data analysis, machine learning, statistics, and web scraping, and it provides resources for further learning in Python programming.

Opinions

  • The author, Martin Thoma, suggests that the abundance of Python tutorials can make it challenging for beginners to choose a starting point, indicating a need for clear and concise learning resources.
  • Anaconda is recommended as a user-friendly distribution for Python and R, implying its suitability for newcomers to Python development on Windows.
  • The use of Spyder as an editor is encouraged for its built-in features like the Variable Explorer, which is considered particularly helpful for beginners.
  • The article conveys the importance of package management in Python, highlighting pip as a powerful tool for extending Python's functionality by installing packages like pyperclip.
  • Jupyter notebooks are presented as a valuable tool for data scientists, praised for their ability to combine code, images, and text, and for facilitating an interactive coding experience without the need for frequent restarts.
  • The author expresses a preference for the official Python tutorial and the Python Jumpstart course for readers with or without prior programming experience, suggesting these resources for a solid foundation in Python.

How to start Python Development on Windows 10 with Anaconda

Learn how to execute Python on Windows 10 via Anaconda in 3 ways: Via editor, via console and via Jupyter notebook

Image taken by Martin Thoma

The Python programming language is used for web development, data analysis, machine learning, statistics, web scraping, and so much more. There are tons of tutorials which, ironically, makes it pretty hard to recommend one. However, there is also a lack in support for Windows.

Let’s get the very first step done: Install it on Windows. After reading this article you will be able to execute Python in 3 different ways on a Windows 10 machine via Anaconda. This prepares you to go with one of the many tutorials to start your Python career.

Anaconda Installation

Anaconda is a Python and R distribution. It does not only bring the Python interpreter, but also an editor called Spyder and Jupyter Notebooks. I’ll explain that later.

Download Python 3 for Windows — at the time of writing, Python 3.7 and most likely the 64-bit Edition. Use the default values and install it. After that, you should see the Anaconda Navigator in your programs.

The Anaconda Navigator is your entry point to start the editor Spyder or Jupyter Notebooks; Screenshot taken by Martin Thoma

Run Python through Spyder

Now Launch Spyder. You will be prompted with a lot of different things. You can just click them away.

In the left window, you enter your code. In the bottom right window, you can see output when your code executes. In the top right you can choose between many options. I think the “variable explorer” is most helpful. Screenshot taken by Martin Thoma

Then enter some hello world code:

print("Hello World")
print(4*7)

And click on the green “play” button. You will be prompted with options how to run this file. Just leave all at default and click on “Run”:

This is how the output should look like.

Congratulations, you executed Python code!

How to install packages for Anaconda?

Installing packages gives you super powers: You can execute other peoples code — code written by hundreds and thousands of people!

Go back to the Anaconda Navigator and click on CMD.exe Prompt. A window with black background and white text will appear. This is a terminal. It’s sometimes also called console or shell (see the exact terminology; it doesn’t matter for now). Enter the following:

pip install pyperclip

pip is a command-line tool to install packages for Python.

After entering the command, it should look like this:

Install the package pyperclip

Congratulations, you’ve just installed one of 200,000 Python packages!

To test it, go back to Spyder and enter the following code:

import pyperclip
print("This is currently in your clipboard: " + pyperclip.paste())
pyperclip.copy("Pyperclip can copy something to your clipboard")

Run Python via Terminal

Start a terminal via the Anaconda Navigator / CMD.exe and enter python . This will start the interactive Python shell:

The interactive shell waits for your input after the >>>

The string >>> is called a prompt and it indicates that you should enter something. You can enter any Python code you want. For example:

>>> 4+7
11
>>> 2**3
8
>>> print("Hello World")
Hello World

You’ve just mastered the next milestone in your Python career — using the interactive shell! It’s also called a REPL for Read-Evaluate-Print-Loop. It is extremely useful for quickly trying things out.

Run Python in Jupyter notebooks

Jupyter notebooks are the data scientists tool of choice. They can be hosted in the web and include images and text directly next to the code. There are pretty impressive examples out there. The charm of it is that you don’t need to restart the execution over and over again. Still, for real development it’s not a good fit.

Click on “Launch Jupyter Notebook” in the Anaconda Navigator.

Jupyter opens in your default browser. The folders / files shown will differ, of course.

Click on “New” in the upper right corner below Quit / Logout. In the dropdown menu, you can see “Python 3”. Click on that:

An empty Jupyter notebook. You should enter a reasonable name in the very top (“Untitled”). This will be the file name.

Enter some code (e.g. print(3*7) and hit Shift+Enter. It should now print 21 and give you a new box to enter code:

Enter Python code

Amazing, you’ve just used Jupyter notebooks the first time! There are way more things you can do with Jupyter.

How can I continue?

If you want an introduction into Python from the beginning, try the official Python tutorial. Although I already had programming experience when I started with Python, I went through this to make sure I know the basics.

If you have some programming background, there is also the Python Jumpstart by building 10 apps. I haven’t tried it, but I love the talk Python podcast.

Python
Programming
Beginners Guide
Windows 10
Software Development
Recommended from ReadMedium