In this tutorial, we shall install Python IDE, PyCharm, create a Python project, configure the Python interpreter, and write our first Python Hello World program.

Python Hello World Program in PyCharm IDE

A Python Hello World program is usually the first program written by a beginner. It checks that Python is installed correctly, the IDE can find the Python interpreter, and a Python file can run without errors.

Before creating the program in PyCharm, make sure Python 3 is already installed on your computer. You can verify it from a terminal or command prompt using one of the following commands.

</>
Copy
python3 --version

On Windows, the command may be:

</>
Copy
python --version

Install PyCharm Community Edition for Python Development

Download Community Edition of PyCharm fromhttps://www.jetbrains.com/pycharm/download/.

PyCharm Download - Python IDE Setup - Python Tutorial - www.tutorialkart.com
PyCharm Download

Download the installer or archive suitable for your operating system. PyCharm Community Edition is enough for writing and running beginner Python programs.

Extract the package and go to bin folder, and run “./pycharm.sh” from the terminal

</>
Copy
cd pycharm-community-*/bin
./pycharm.sh

On Windows and macOS, you can start PyCharm from the installed application shortcut instead of running the shell script.

PyCharm Theme Selection - PyCharm IDE - Python Tutorial - www.tutorialkart.com
PyCharm Theme Selection

Select a theme that is comfortable to read and continue. The theme choice does not affect the Python program.

PyCharm should ask for a restart.

PyCharm Restart - PyCharm IDE - Python Tutorial - www.tutorialkart.com
PyCharm Restart

Click Yes and the PyCharm restarts.

PyCharm Restarts - PyCharm IDE - Python Tutorial - www.tutorialkart.com
PyCharm Restarts

After PyCharm restarts, the welcome screen appears. From this screen, you can create a new project or open an existing Python project.

Create New Project - PyCharm IDE - Python Tutorial - www.tutorialkart.com
Create New Project

Click on “Create New Project”.

Create a PyCharm Project for Python Hello World

Choose a project location and provide a clear project name, such as PythonTutorial or HelloWorldProject. PyCharm also asks for a Python interpreter. The interpreter is the Python executable used to run your program.

Project Name and Interpreter Selection - PyCharm IDE - Python Tutorial - www.tutorialkart.com
Project Name and Interpreter Selection

Click on the settings button next to the interpreter field and click on “Add”. Browse to the installed Python 3 location, select the interpreter, and click on “Create” button.

The location of Python 3 can be found using the whereis python3 command on Linux or macOS.

</>
Copy
whereis python3

On Windows, you can usually check Python from Command Prompt with:

</>
Copy
where python
Whereis Python3 - PyCharm IDE - Python Tutorial - www.tutorialkart.com
Whereis Python3

After the project is created, the PyCharm IDE window is displayed with the project name in the Project files section.

Create helloworld.py Python File in PyCharm

Right Click on the project “PythonTutorial” -> New -> Python File

helloworld.py - PyCharm IDE - Python Tutorial - www.tutorialkart.com
helloworld.py

Name the file helloworld.py. The .py extension tells PyCharm and Python that this file contains Python code.

Write Python Hello World Program Using print()

Enter the print statement in helloworld.py as shown below and save.

helloworld.py print statement - Python Helloworld Program - Python Tutorial - www.tutorialkart.com
helloworld.py print statement

The complete Python Hello World program contains one line of code.

</>
Copy
print("Hello World!")

In this program, print() is a built-in Python function. It displays the text passed inside the parentheses. The text "Hello World!" is a string because it is enclosed in quotes.

Run helloworld.py in PyCharm

Right click on helloworld.py and click on “Run helloworld.py”

Run helloworld.py - Python Helloworld.py Program - Python Tutorial - www.tutorialkart.com
Run helloworld.py

“Hello World!” is printed and the process is finished.

The expected output is:

Hello World!

Run Python Hello World Program from Terminal

You can also run the same Python file from a terminal. Open the terminal in the project folder and use the following command.

</>
Copy
python3 helloworld.py

On Windows, use:

</>
Copy
python helloworld.py

Both commands run the Python file and print the same output.

Hello World!

Common PyCharm and Python Hello World Issues

IssueLikely reasonFix
PyCharm shows no Python interpreterPython is not selected for the projectOpen project settings and add the installed Python 3 interpreter.
python command is not recognizedPython is not added to PATHUse the full interpreter path, use py on Windows, or update PATH during Python installation.
The program runs but prints nothingThe file may be empty or not savedSave helloworld.py and confirm it contains print("Hello World!").
SyntaxError near Hello WorldQuotes or parentheses may be missingUse the exact syntax print("Hello World!").

Python Hello World Program FAQ

What is the Python Hello World program?

The Python Hello World program is a simple program that prints Hello World! on the screen. It is commonly used to confirm that Python and the development setup are working.

Do I need PyCharm to write a Python Hello World program?

No. PyCharm is useful because it gives an editor, project view, and run button, but you can write the same program in any text editor and run it from the terminal.

Why does PyCharm ask for a Python interpreter?

PyCharm needs a Python interpreter to execute Python code. Without an interpreter, the IDE can edit files but cannot run the program.

Should I use python or python3 to run helloworld.py?

Use the command that points to Python 3 on your system. On many Linux and macOS systems, python3 helloworld.py is safer. On Windows, python helloworld.py is commonly used.

What does print() do in the Python Hello World program?

print() displays output on the screen. In print("Hello World!"), Python prints the string value inside the quotes.

Python Hello World Editorial QA Checklist

  • Confirm that the PyCharm download link points to the Community Edition download page.
  • Check that the tutorial clearly separates installing PyCharm, creating a project, choosing an interpreter, and running helloworld.py.
  • Verify that every new command-line code block uses language-bash syntax.
  • Verify that the Python code example uses language-python syntax.
  • Confirm that the expected program output uses the output code block class.

Conclusion: Python IDE Setup and Hello World Program

In this Python Tutorial, we have learnt how to setup PyCharm IDE for Python Development, create a Python project, select a Python interpreter, write helloworld.py, and run our first Python Hello World program.