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.
- What is PyCharm
- How to install Python on Windows
- How to install PyCharm on Windows
- How to install Python on Mac OSX
- How to install PyCharm on Mac OSX
- How to install Python on Ubuntu
- How to install PyCharm on Ubuntu
- How to set up PyCharm with the Python SDK
- How to set up a project in PyCharm on Windows, Mac, Ubuntu
What is PyCharm
PyCharm is a Python integrated development environment made by Jetbrains . 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.
- Navigate to the Python downloads page in your browser.
- Click on the Download Python 3.x.x button to download the installer.
- 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.
- Navigate to the Toolbox App in your browser and click on the Free Download button.
- Run the installer and follow the steps in the wizard.
- Run the Toolbox App and review the licence agreement.
- Create a JetBrains account or skip it.
- 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:
- Navigate to the download page in your browser and click on the Download button of the Community Edition.
- 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.
- Navigate to the Python downloads page in your browser.
- Click on the Download Python 3.x.x button to download the installer.
- 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.
- Navigate to the Toolbox App in your browser and click on the Free Download button.
- Mount the .dmg disc image and drag the Toolbox App to your Applications folder.
- Run the Toolbox App and review the licence agreement.
- Create a JetBrains account or skip it.
- 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.
- Navigate to the Toolbox App in your browser and click on the Free Download button.
- Extract the tarball to any directory that supports file execution, like the/opt directory.
- Run the installer with sudo tar -xzf jetbrains-toolbox-*.tar.gz -C /opt , where * is your specific version number.
- 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.
- Review the licence agreement.
- Create a JetBrains account or skip it.
- 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.
- On the welcome screen, click on the Configure dropdown menu. Or, in PyCharm, go to File > Settings for new projects.
- Select Settings.
- Choose Project Interpreter in the dialog box.
- Click on the cog icon to the right of the Project interpreter field and click on Add.
- 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. - Click OK and wait for the SDK to be set up.
- 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.
- On the welcome screen, click on Create New Project. Or, inside PyCharm, go to File > New Project.
- 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.
- Click Create .
Now we’re all set up and ready to start programming with Python.