Pycharm is one of the best python IDEs for professional developers. However, users may regularly encounter errors when using it.

Beginners are the most vulnerable because they have little experience working with this Software. This article will solve a common error that beginners stumble upon when starting to code in Pycharm.

The error in question is shown in the screenshot below. It occurs when a developer is trying to execute a code.

Error Running 'main' in Pycharm

As you can see, the error message reads, “Error running ‘main’: @NotNull method com/intellij/execution.configurations.GeneralcommanLine.getExePath must not return null. So what is it exactly, and how can you solve this?

If you encounter this error, Pycharm is simply trying to tell you that you don’t have an interpreter installed. In other words, you don’t have python installed on your computer.

Adding an interpreter in Pycharm

You have two choices. You can add an interpreter using the option highlighted in blue, as seen in the screenshot above, or you can download python and install it from the official website.

If you don’t want to get out of the PyCharm Software, proceed with the “add interpreter” option. If you do that, you’ll see the screenshot below.

Approve python installation in python

The next step should be to click the “OK” option. If you do that, the next screen you see will be similar to the one you now see below.

Downloading Python in Pycharm

Once the download is complete, the program will start to install.

Running python installation in Pycharm

If your python installation gets canceled, the Software will give you an option for installing python manually. You can install it manually or proceed to click okay on the next screen, as shown below.

Cancellation of Python installation in Pycharm

A successful manual installation will help you get back to the PyCharm home screen. Now, if you test your python code, you will learn that your code works when you execute it.

error running main in Pycharm now solved

If you have any issues, please post them in the comments section. Good luck as you continue to code!!. Thank you for visiting our website.

Author: Victor WachangaWriter, 3D artist, and thinker. Tech is fascinating. Tech is scary

We value your opinion