Getting started with PyCharm (for new Python developers)

Getting started with PyCharm (for new Python developers)
Published: by
Last updated:

One can’t go wrong with choosing Python to learn as their first programming language. This post will show how to get started with PyCharm, an IDE for Python and Scientific development.

This is an ongoing post. Please suggest corrections, explanations, etc. in the comment section at the bottom of this page.

To start programming with Python, you will need the appropriate software. Technically, with a bit of knowledge, any basic text editor can be used to program Python. More popular than text editors these days are IDEs (integrated development environments). Of course, it depends on the IDE used, but they offer additional features such as text highlighting, error checking, auto-correction, etc.

PyCharm, a product of Jetbrains, is such an IDE that is available for Windows, MacOS and Linux operating systems. It has a Professional, paid version, with a full set of features for programming and, a lightweight, but free, Community version – which is perfect for beginners. Jetbrains also offers PyCharm Edu, which offers a more stimulating learning environment for learners and teachers. In this post, we will be using the PyCharm Community version.

PyCharm home page

The community version of PyCharm offers, among other things, colour coding, autocomplete, error checking, best practices and a terminal (e.g. for installing pip packages from pypi.org and running other commands). PyCharm also has the ability to work with HTML and CSS code.

Other options for newbie Python developers, probably among many others, include Raspbian (on the Raspberry Pi), Eclipse IDE and Geany.

Installing Python on your computer

Before PyCharm is installed, the desired version of Python needs to be downloaded and installed first.

By default, some computers come pre-installed with Python, which will usually be Python 2.x. Python 2 is considered legacy, which means it is no longer maintained or supported. Python 2 and Python 3 are very similar, but does have small differences when it comes to some commands. Python 2 code cannot be executed in Python 3 and vice versa. While setting up the IDE, the version of Python installed (2 or 3) needs to be known. By repeating the installation process, multiple versions of Python can be installed on the same computer.

Taking this into consideration, the desired version of Python (version 2.x or 3.x) can be obtained from www.python.org. To add Python to PATH (recommended), make sure to click the Add Python to PATH checkbox. Simply use the Install Now option. All the other installation settings can be left to their defaults.

Python Windows installer
The Windows installer of Python. In this image, version 3.8.0 will be installed. Click the checkbox (red circle) to add Python to PATH.

After the installation is finished, click the Close button and move onto installing PyCharm.

Downloading and installing PyCharm

The Community version of PyCharm can be downloaded from its download page on Jetbrains.

PyCharm download page
PyCharm download page. Here you can choose the version to download. In this post, we will be using the Community version.

At the time of writing, the PyCharm installation file is about 250MB and the space required is about 600MB. The installation file will start the PyCharm installation Wizard. Here the installation destination, desktop icons, etc. need to be set. If you’re not sure what you’re doing, rather leave all the settings to their defaults. After PyCharm has been installed, the Wizard will end off asking to open the application.

When PyCharm is executed for the first time, there will be another couple of once-off steps to be completed. Read the instructions carefully to choose the most appropriate setting, but if in doubt, stick to the default settings. For beginners, rather do not add any featured plugins (e.g. IdeaVim and Markdown. After clicking on the Start using PyCharm button (or executing the application at a later stage), the following startup screen will appear:

Welcome to PyCharm screen

Creating a project with PyCharm

After clicking on the + Create New Project button, PyCharm will slide to the new project screen. Here, the location of the project and the interpreter needs to be set.

Creating a new Python project in PyCharm

Make sure the Base interpreter is set to the desired version of Python (i.e. 2 or 3). This will in most cases be the version of Python that you downloaded prior to installing PyCharm.

The Python interpreter is basically a program, that knows how to execute Python code. It will interpret, or translate, Python instructions into instructions that a computer can understand. If you have multiple versions of Python installed on your PC, use the drop-down arrow to change the interpreter to the desired version of Python.

PyCharm project screen

After clicking the Create button, PyCharm will build a virtual environment for the project. It will also offer some tips (which can be disabled for future projects). Close the tips after going through them.

PyCharm new file

The main file types to be used when programming in Python and PyCharm is Python files. Python files have .py as its extension. To create a new .py file, right-click on the project name (in this case it’s called HelloWorld, select New and then Python File.

PyCharm new python file

A New Python file popup will appear. Use this to give your file a name and press on Python file.

PyCharm Python file

In this case, a file called app was created. The .py extension is created automatically. After creation, the file will automatically be opened for editing in the main screen of PyCharm. It will also be listed under the project name that was created earlier. By using the same process, more Python files can be created/added to the project at a later stage.

Hello, world

To test Eclipse’s new Python environment, get started with “Hello, World”. After creating a new Python file (see above), the following code can be added to a Python file (in this case app.py):

For Python 2.x use:
print "Hello, World!"
and for Python 3.x use:
print("Hello, World!")

PyCharm run

To run the Python code, Choose Run from the top menu and then Run… Another popup will appear. Either click on the Python file (in this case app) or on the right arrow and choose Run.

PyCharm run run

The code will now be executed at the bottom PyCharm’s terminal window, showing its results and any errors Python might have encountered.

The file will be automatically be saved when it is closed. The File menu can be used to save the file as something else.

About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.
Behind the Scenes is a free, informative website. If you find value in any of our content, please consider making a donation to our cause.
Donate via PayPal

Save, share & Disqus

Use the buttons below, on the left or the bottom of this page to share this post. Your comment is important, but don't be a knob. Keep it constructive and polite.

Comment via Disqus

Disqus is a worldwide comment hosting service for web sites and online communities. This secure platform ensures a pleasant commenting environment which is manageable from one account. Use the Login button to sign up.

More API, Python & Website development related posts

Discover the easy way to send bulk SMS from your PC, Mac or mobile device
Discover the easy way to send bulk SMS from your PC, Mac or mobile device
11 December 2019
Ad: Using the latest in technology, WinSMS offers cost effective messaging solutions that makers and business owners can use. With their online portal and API functionality, buying SMS bundles and sending them to recipients is more cost effective and easy to do. More…
Getting started with private projects on Raspbian and Bitbucket
Getting started with private projects on Raspbian and Bitbucket
28 October 2018
Bitbucket is a great alternative to Github to start, store and track simple programming dependant project files. On a Raspberry Pi it can be simply done using Raspbian. In addition to Github, projects uploaded to Bitbucket with less than 6 contributors can be kept private and won’t cost a cent. More…
Using Cron to schedule tasks
Using Cron for scheduling tasks
30 June 2017 | Updated 11 July 2017
Cron is an Unix-like operating system software utility used to schedule automatic time-based commands. Entered commands can be in the form of Bash or Bash scripts that are meant to be automatically executed periodically at fixed times, dates or intervals. More…