2 Your Python Environment


This chapter covers

  • Building a toolchain
  • Python virtual environments
  • Setting up Visual Studio Code

As a Python developer, you need an environment on your PC in which to work. This developer environment covers a lot of ground. In general, it includes a set of tools you’re familiar with and some ideas about how you’re going to structure project directories. Depending on your computer, it might also include environment variables you’ve set to help make things more automatic and useful.

For everyone, keep in mind the environment you’re about to create is what will be used in this book when you get to programming examples.

You’ll find what you’re about to create and configure is a good starting point towards building your own useful and powerful development environment. For those of you who already have a development environment you’re comfortable with, feel free to skim or disregard this chapter. However, be aware of the differences presented here you’ll need to account for in your environment.

2.1   Installing Python

First, you’re going to need Python installed on your PC. This might seem obvious, but it’s a little more involved than it might first appear. Not all operating systems come with Python installed, and sometimes when Python is installed, it’s an older version. Even if the version of Python already installed on your PC is recent, it’s still a good idea to install Python for your own use while developing.

2.1.1   Windows

2.1.2   Mac

2.1.3   Linux

2.2   Python Virtual Environment

2.2.1   Windows

2.2.2   Mac and Linux

2.3   Setting up Visual Studio Code

2.3.1   Installing Visual Studio Code

2.3.2   Installing Python Extension

2.3.3   Starting From the Command Line

2.3.4   Starting a Project

2.4   One More Thing

2.5   Summary