Python Development Environment Setup for Windows, Mac OSX and Ubuntu

In this tutorial we learn how to install both Python, and the free PyCharm IDE from JetBrains on Windows, Mac OSX, and Ubuntu Linux.

We also cover how to set up a PyCharm project to get you up and running in no time.

Here's a table of contents of what you'll learn in this lesson:
(click on a link to skip to its section)

Let's jump right in.

What is PyCharm

PyCharm is a Python integrated development environment made by JetbrainsOpens up in a new page . PyCharm features everything we need to create Python applications, and we will be using it in this tutorial series instead of the default IDLE.

PyCharm provides us with:

  • Project setup and navigation within the editor.
  • Code completion.
  • Error checking with quick fixes.
  • PEP8 checks for improved code quality.
  • Smart refactor.
  • Assistance with testing and many more features.

PyCharm is available in free and paid versions. For this tutorial series we will be using the Community version, which is PyCharm’s free offering.

JetBrains provides us with a convenient application manager to download and install PyCharm. We recommend using the Toolbox App to install PyCharm.

How to install Python on Windows

Before we can start learning, we will need access to the Python 3 interpreter. Follow the steps below to install Python on Windows.

  1. Navigate to the Python downloadsOpens up in a new page page in your browser.
  2. Click on the Download Python 3.x.x button to download the installer.
  3. Run the installer and follow the steps in the installation wizard.

How to install PyCharm on Windows

We will use the Toolbox App to install PyCharm on Windows.

  1. Navigate to the Toolbox AppOpens up in a new page in your browser and click on the Free Download button.
  2. Run the installer and follow the steps in the wizard.
  3. Run the Toolbox App and review the licence agreement.
  4. Create a JetBrains account or skip it.
  5. In the Tools tab, locate PyCharm Community edition and click Install.

Once PyCharm is installed, we can run the application by clicking on its name in the Tools tab of the Toolbox App.

If you want to download and install it manually:

  1. Navigate to the download pageOpens up in a new page in your browser and click on the Download button of the Community Edition.
  2. Once the download has finished, run the installer and follow the steps in the wizard.

For the next step, please see the section below on how to set up PyCharm to recognize the Python SDK , which is the same for Windows, Mac and Ubuntu.

How to install Python on Mac OSX

Before we can start learning, we will need access to the Python 3 interpreter. Python 2 ships with the Mac OSX operating system, but we want the latest stable version. Follow the steps below to install Python on Mac OSX.

  1. Navigate to the Python downloadsOpens up in a new page page in your browser.
  2. Click on the Download Python 3.x.x button to download the installer.
  3. Run the installer and follow the steps in the installation wizard.

How to install PyCharm on Mac OSX

We will use the Toolbox App to install PyCharm on Mac OSX.

  1. Navigate to the Toolbox AppOpens up in a new page in your browser and click on the Free Download button.
  2. Mount the .dmg disc image and drag the Toolbox App to your Applications folder.
  3. Run the Toolbox App and review the licence agreement.
  4. Create a JetBrains account or skip it.
  5. In the Tools tab, locate PyCharm Community edition and click Install.

Once PyCharm is installed, we can run the application by clicking on its name in the Tools tab of the Toolbox App.

For the next step, please see the section below on how to set up PyCharm to recognize the Python SDK , which is the same for Windows, Mac and Ubuntu.

How to install Python on Ubuntu

Before we can start learning, we will need access to the Python 3 interpreter. Python 3 ships with the Ubuntu operating system so you don’t have to install anything, as long as your system is relatively up to date.

Python is used within the GUI of many Linux distributions, like Ubuntu. When uninstalling Python, or installing different versions of it, it’s possible to get into a situation where Linux won’t boot with a GUI. Your current Python 3 version should be fine.

How to install PyCharm on Ubuntu

We will use the Toolbox App to install PyCharm on Ubuntu.

  1. Navigate to the Toolbox AppOpens up in a new page in your browser and click on the Free Download button.
  2. Extract the tarball to any directory that supports file execution, like the/opt directory.
  3. Run the installer with sudo tar -xzf jetbrains-toolbox-*.tar.gz -C /opt , where * is your specific version number.
  4. Once PyCharm is installed, we execute the jetbrains-toolbox binary from the extracted directory. After the Toolbox App has been run for the first time, it will add its icon in the main menu.
  5. Review the licence agreement.
  6. Create a JetBrains account or skip it.
  7. In the Tools tab, locate PyCharm Community edition and click Install.

Once PyCharm is installed, we can run the application by clicking on its name in the Tools tab of the Toolbox App.

For the next step, please see the section below on how to set up PyCharm to recognize the Python SDK , which is the same for Windows, Mac and Ubuntu.

How to set up PyCharm with the Python SDK

Just in case it didn’t find the Python SDK on its own, we’ll go through the steps of how to configure the Python SDK on PyCharm.

When PyCharm runs for the first time, it will present you with a welcome screen.

  1. On the welcome screen, click on the Configure dropdown menu. Or, in PyCharm, go to File > Settings for new projects.
  2. Select Settings
  3. Choose Project Interpreter in the dialog box.
  4. Click on the cog icon to the right of the Project interpreter field and click on Add.
  5. Select VirtualenvEnvironment.
    a. We can leave the Location field unchanged. It should default to the home directory.
    b. Ensure the Inherit global site-packages box is checked.
    c. Ensure the Make available to all packages box is checked.
  6. Click OK and wait for the SDK to be set up.
  7. Finally, click on OK again.

At this point, we’ve got the installation set up, and ready to go. The only thing left to do now is set up a project.

How to set up a project in PyCharm on Windows, Mac, Ubuntu

Follow the steps below to learn how to set up a new project in PyCharm.

  1. On the welcome screen, click on Create New Project. Or, inside PyCharm, go to File > New Project.
  2. Specify a directory in the Location field that you want to use as your project directory. We used a directory called “PyProjects”.

    If there is an option to select the type of Project, you can select Pure Python as the template.

  3. Click Create.

Now we’re all set up and ready to start programming with Python.