Python PyCharm Installation and Usage
PyCharm is a Python integrated development environment (IDE) from JetBrains, featuring intelligent code completion and graphical debugging, and supporting Windows / macOS / Linux.
PyCharm is an all-in-one tool for writing code, running programs, debugging, managing projects, and collaboration, and is currently the industry's most popular Python development tool.
In this chapter we will cover the installation of Python and PyCharm, and create and run your first Python program.
| Stage | Content |
|---|---|
| 1. Install Python | Download, install, and verify the Python interpreter |
| 2. Install PyCharm | Download and install the PyCharm Community edition |
| 3. Create a project | Create a new project and a Python file |
| 4. Write and run code | Write hello.py and run it |
Install Python
Python is the interpreter required to run Python programs, and PyCharm relies on it to execute code.
Installing Python consists of three steps: download the installer, run the installation, and verify the result.
Download Python
Open a browser and visit the download page on the official Python website:https://www.python.org/downloads/。
The website usually detects your operating system automatically (Windows / macOS / Linux); click the yellow button on the page to download the latest version.

Python 3.10 or above is recommended; mainstream tutorials and third-party libraries support newer versions better. Python 2.x reached end of life in 2020 and should no longer be used.
Install Python
The following uses Windows as an example; macOS and Linux users should refer to the corresponding instructions.
Windows installation steps:
| Step | Operation | Description |
|---|---|---|
| 1 | Double-click the installer | Run the downloaded .exe file, for example python-3.12.x-amd64.exe |
| 2 | Check the PATH option |
A critical step: At the bottom of the installation screen, check Add python.exe to PATH, otherwise the command line may not be able to find Python
|
| 3 | Click Install Now | Just wait for the installation progress bar to complete |
macOS users:
You can double-click the .pkg installer and follow the prompts, or install it through the Homebrew package manager:
brew install python3
Verify the installation
Open a command-line tool (Command Prompt or PowerShell on Windows, Terminal on macOS) and enter the following command:
python --version
If a version number like Python 3.12.0 is displayed, the installation was successful.
On some systems (especially macOS/Linux) the built-in python command points to Python 2; in that case you need to enter
python3 --versionto check the newly installed Python 3.
Install PyCharm
PyCharm is developed by JetBrains and is one of the most popular Python IDEs today.
It comes in two editions; beginners can choose the free Community edition:
| Version | Cost | Intended users | Main Function |
|---|---|---|---|
| Professional | Paid | Professional developers | Supports a full set of features including web development, database tools, and scientific computing |
| Community | Free | Beginners / students | The core features for pure Python development, entirely sufficient for beginners |
Download PyCharm
Visit the PyCharm download page on the JetBrains website:https://www.jetbrains.com/pycharm/download/。
Find the Download button on the page and click the download button for your operating system.

Install PyCharm
Installation methods for different operating systems are as follows:
| Operating system | Installation method |
|---|---|
| Windows | Double-click the .exe installer and keep clicking "Next". It is recommended to check "Create desktop shortcut" |
| macOS | Double-click the .dmg file and drag the PyCharm icon into the Applications folder |
| Linux | You can extract the .tar.gz archive and run bin/pycharm.sh, or install it via Snap |
Linux Snap installation command:
sudo snap install pycharm-community --classic
After installation, open PyCharm. The first launch will guide you through choosing a UI theme and keymap; keep the defaults or choose according to your preference.
Install PyCharm
Windows
- Double-click the downloaded installation file (
.exe)。 - In the installation wizard, choose the installation path; the default path is recommended.
- Check "Create Desktop Shortcut" so that PyCharm can be launched quickly.
- Click Install to start the installation.
- After installation, click Finish to exit the installation wizard.

macOS
- Open the downloaded
.dmgfiles. - Drag the PyCharm icon into the "Applications" folder.

- Find PyCharm in the "Applications" folder and double-click to launch it.

Linux
- Extract the downloaded
.tar.gzfiles.tar -xzf pycharm-*.tar.gz
- Enter the extracted directory and find the
binfolder.cd pycharm-*/bin
- Run
pycharm.shLaunch PyCharm../pycharm.sh
Configure PyCharm
When you launch PyCharm for the first time, you will be prompted for some initial configuration; you can set the language and agree to the license:


After launch, you can adjust settings to your preference:

Choose a theme: You can choose the "Darcula" (dark) or "Light" theme.

Configure the Python interpreter: If you have already installed Python, PyCharm will detect and configure the interpreter automatically. If not, you can add it manually.

Install plugins: PyCharm will recommend some common plugins; you can install them as needed.

Create your first project
PyCharm manages code in units of projects; one project corresponds to one folder, which can contain multiple Python files.
Create a new project
After opening PyCharm, click the New Project button on the welcome screen.

In the creation dialog that appears, you need to confirm two settings:
| Setting | Description | Example |
|---|---|---|
| Location | The path where the project folder is saved | D:\PythonProjects\HelloWorld |
| Python Interpreter | The path to the Python interpreter; PyCharm usually detects it automatically | If it is not detected automatically, select it manually python.exe or python3 |

Once everything is correct, click the Create button in the bottom-right corner.
The project path should not contain Chinese characters or spaces, otherwise some third-party tools may behave abnormally. A fully English path is recommended.
Create a new Python file
After the project is created, follow these steps in the main PyCharm window to create a Python file:
| Step | Operation |
|---|---|
| 1 | In the Project panel on the left, right-click the project root directory |
| 2 | Choice New → Python File |
| 3 | Enter a file name (such as hello_runoob), then press Enter to confirm |


PyCharm will automatically create the hello_runoob.py file and open it in the editor on the right for you to write code.
Write and run your first program
Once the file is created, write some code and run it to see a Python program in action.
Write the code
in hello_runoob.py Enter the following code in the file:
Example
File: hello_runoob.py
The first Python program: greet the user and interact with them
The print() function outputs text on the screen
(
"Hello, World!"
)
The input() function waits for the user to type something on the keyboard and returns a string
The text in parentheses is the prompt shown to the user
name
=
input
(
"Please enter your name: "
)
An f-string (formatted string) lets you embed variables directly inside a string
Variables inside braces {} are replaced with their values
(
f
"Hello, {name}! Welcome to learning Python."
)

This code does three things:
| Code | Purpose |
|---|---|
print("Hello, RUNOOB!") |
Print a fixed greeting on the screen |
input("请输入你的名字:") |
Display a prompt on the screen, wait for the user to enter their name, press Enter, and store the input in a variable name |
print(f"你好,{name}!...") |
Use an f-string to embed the value of the variable name into the greeting, producing personalized output |
Run the program
PyCharm provides several ways to run a program; choose any one of them:
| How to run | Operation |
|---|---|
| Right-click menu | Right-click anywhere in the editor and choose Run 'hello' |
| Run button | Click the green triangle button in the top-right corner of the editor |
| Keyboard shortcut | On Windows/Linux press Shift + F10, on macOS press Ctrl + R |

After running, the Run window appears at the bottom of PyCharm and displays the program output:
Hello, RUNOOB!
请输入你的名字:runoob
你好,runoob!欢迎学习 Python。
进程已结束,退出代码为 0
Type your name in the input area of the Run window and press Enter to see the personalized greeting.
If running the code reports "No Python interpreter configured"it means PyCharm did not find the Python interpreter. Go to
File → Settings → Project → Python Interpreterand specify the Python installation path manually to fix it.
Troubleshooting common problems
When you first start using Python and PyCharm, these are the four most common problems and their solutions.
| Symptom | Possible cause | Solution |
|---|---|---|
Entering a command in the terminal python The message "is not recognized as an internal or external command" appears |
Add to PATH was not checked during installation | Re-run the installer and check that option, or add the Python path to the system environment variables manually |
| PyCharm reports that no interpreter can be found | PyCharm did not detect Python automatically | in File → Settings → Project → Python Interpreter manually specify the path to the Python executable in |
| Nothing happens or an error occurs when running the code | Indentation error in the code or the file is not saved | Check that the code indentation is consistent (Python strictly requires indentation) and that the file has been saved (an unsaved file has a dot marker next to its name) |
| Garbled Chinese output | The file encoding is not UTF-8 | in File → Settings → Editor → File Encodings set the encoding to UTF-8 in |
