Setting Up Python with PyCharm
You will learn how to set up a development environment where you can write Python code. Skip this if you already have one!
Table of contents
Introduction
Since Python is very popular, there are many different IDEs that a developer can use to get started. There are popular IDEs and less known IDEs. There are Python-specific IDEs and IDEs that support a wide range of languages. It's important to pick the right one based on how much you will be programming in Python and what other programming languages you may already know. In this article, I will go over how to set up PyCharm, an IDE for writing Python code. This IDE is one of the world's most used for Python.
PyCharm
PyCharm is a Python-only IDE developed by JetBrains. JetBrains has tons of different IDEs for different languages and their Python IDE is one of the world's most used IDEs (for Python).
Here are the steps to downloading PyCharm and Python for your operating system.
Find the PyCharm Community Edition and select your operating system from the latest PyCharm version (first row.)
If you don't know what operating system you have, try and look at your computer specs or search up your computer and then 'operating system' to find out.
It's important that you select the right option. Each operating system choice has two options. One is 32-bit and the other is 64-bit. Just like above, try looking at computer specs or googling if your computer is 32-bit or 64-bit to find out.
After finding your option, select it and your download should start and you will be taken to a welcome page.
After your download has completed, make your way to your file explorer, finder, wherever your downloaded files are, and find the pycharm.exe file. It won't be named pycharm.exe but it will have the words in it and that's how you know it's PyCharm. Your IDE hasn't been downloaded yet, you just downloaded the installer to install the IDE on your computer. After finding your .exe file, open it and your download will start.
Click next until you see a window with some checkboxes.
Select 'Create Desktop Shortcut' and click 'Next' again. You should see a page with a big list of options. Don't change that and just click the 'Install' button. Then your actual installation should start!
After PyCharm has finished downloading, you should get a window saying download completed and a run PyCharm checkbox. Check that and click the 'Finish' button.
Once the IDE is set up, you should see a screen like this.
If you have no projects, there won't be any list of directories and you should only see some options to open a project, create a project, etc.
Congratulations! You have installed your first Python IDE! Now you can create projects, run code, and do much more!
The Python Interpreter
Different programming languages have different ways to run code. There is a compiler or an interpreter. A compiler reads all the code, checks it, and then runs it if there are no errors. An interpreter reads the code line by line and runs it after each line. With an interpreter, some code might be run even though there is an error in the whole code. Let's say there's an error in your code at line 30 and before that, you are writing a random letter to a file. The letter will be written to the file, but the code will exit at the error. That's because the interpreter doesn't see the broken code until it's checking line 30! Interpreters tend to run slower than compilers because of their CPU and RAM usage. Python is one of the most popular languages, but it's pretty slow for its kind.
If the Python interpreter detects an error in your code, it will find the type of that error (we will go over errors later in the series) and show it on the console. This can be very helpful as the error will show you the line and the general area where the error is being created. It also shows you the reason for the failure so you can change the line according to that.
Conclusion
Python, although slow, is still one of the most popular languages. PyCharm is among the most used Python IDEs in the world. With this knowledge, you should be able to start typing code in the next article of this series, coming on 10/8/2023, Data Types!