Skip to content

Python PyCharm Installation and Usage

PyCharm is a Python Integrated Development Environment (IDE) developed by JetBrains, featuring intelligent code completion and graphical debugging capabilities, supporting Windows / macOS / Linux platforms.

PyCharm is an all-in-one tool for writing code, running programs, debugging, managing projects, and collaboration — it is currently the most mainstream Python development tool in the industry.

This chapter will introduce the installation of Python and PyCharm, and guide you through creating and running your first Python program.

Stage Content
1. Install Python Download, install, and verify the Python interpreter
2. Install PyCharm Download and install PyCharm Community Edition
3. Create a Project Create a new project and Python file
4. Write and Run Code Write hello.py and run it

Python is the interpreter required to run Python programs. PyCharm depends on it to execute code.

Installing Python involves three steps: downloading the installer, running the installation, and verifying the installation result.

Open your browser and visit the Python official website download page: https://www.python.org/downloads/.

The website will usually automatically detect your operating system (Windows / macOS / Linux). Click the yellow button on the page to download the latest version.

It is recommended to choose Python 3.10 or above. Most tutorials and third-party libraries currently have good support for newer versions. Python 2.x has been discontinued since 2020 — do not use it anymore.

The following uses Windows as an example. macOS and Linux users should refer to the corresponding instructions.

Windows Installation Steps:

Step Action Description
1 Double-click the installer Run the downloaded .exe file, e.g., python-3.12.x-amd64.exe
2 Check the PATH option

Critical step: Check Add python.exe to PATH at the bottom of the installation interface, otherwise the command line may not find Python

3 Click Install Now Wait for the installation progress bar to complete

macOS Users:

You can double-click the .pkg installer and follow the prompts to complete the installation, or install via the Homebrew package manager:

brew install python3

Open the 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 system’s built-in python command points to Python 2. In this case, you need to enter python3 --version to check the newly installed Python 3.


PyCharm is developed by JetBrains and is one of the most popular Python IDEs today.

It comes in two editions. Beginners should choose the free Community edition:

Edition Cost Target Audience Main Features
Professional Paid Professional developers Supports web development, database tools, scientific computing, and other full-featured capabilities
Community Free Beginners / Students Core features for pure Python development, fully sufficient for beginners

Visit the PyCharm download page on JetBrains’ official website: https://www.jetbrains.com/pycharm/download/.

Find the Download button on the page and click the download button for your operating system.

The installation methods for different operating systems are as follows:

Operating System Installation Method
Windows Double-click the .exe installer and click “Next” through the steps. It is recommended to check “Create Desktop Shortcut”
macOS Double-click the .dmg file and drag the PyCharm icon into the Applications folder
Linux Extract the .tar.gz and run bin/pycharm.sh, or install via Snap

Linux Snap Installation Command:

sudo snap install pycharm-community --classic

After installation, open PyCharm. The first launch will guide you to choose a UI theme and keyboard shortcut scheme. Keep the default settings or choose according to your personal preference.

  1. Double-click the downloaded installation file (.exe).
  2. In the installation wizard, choose the installation path. Using the default path is recommended.
  3. Check Create Desktop Shortcut for quick access to PyCharm.
  4. Click Install to begin installation.
  5. After installation, click Finish to exit the installation wizard.

  1. Open the downloaded .dmg file.

  2. Drag the PyCharm icon into the “Applications” folder.

  3. Find PyCharm in the “Applications” folder and double-click to launch.

  1. Extract the downloaded .tar.gz file.

    tar -xzf pycharm-*.tar.gz
  2. Enter the extracted directory and find the bin folder.

    cd pycharm-*/bin
  3. Run pycharm.sh to start PyCharm.

    ./pycharm.sh

When you first start PyCharm, you will be prompted to perform some initial configuration. You can set the language and agree to the terms:

After startup, you can configure according to your personal preferences:

Choose a Theme: You can choose the “Darcula” (dark) or “Light” theme.

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

Install Plugins: PyCharm will recommend some commonly used plugins. You can choose to install them as needed.


PyCharm manages code in units of Projects. One project corresponds to one folder, which can contain multiple Python files.

After opening PyCharm, click the New Project button on the welcome screen.

In the creation window that pops up, you need to confirm two settings:

Setting Description Example
Location The save path of the project folder D:\PythonProjects\HelloWorld
Python Interpreter The path to the Python interpreter; PyCharm usually detects it automatically If not auto-detected, manually select python.exe or python3

After confirming everything is correct, click the Create button in the lower right corner.

Do not include Chinese characters or spaces in the project path, as this may cause some third-party tools to run abnormally. Using an all-English path is recommended.

After the project is created, follow these steps in the PyCharm main interface to create a Python file:

Step Action
1 In the Project panel on the left, right-click the project root directory
2 Select New → Python File
3 Enter a file name (e.g., hello_runoob) and press Enter to confirm

PyCharm will automatically generate the hello_runoob.py file and open it in the editor area on the right for you to write code.


After the file is created, write code and run it to see the execution effect of a Python program.

Enter the following code in the hello_runoob.py file:

# File: hello_runoob.py
# First Python program: greet the user and interact with them

# The print() function outputs text to the screen
print("Hello, World!")

# The input() function waits for the user to enter text from the keyboard, returning a string
# The text in parentheses is the prompt message displayed to the user
name = input("Please enter your name: ")

# f-strings (formatted strings) allow embedding variables directly within strings
# Variables inside curly braces {} will be replaced with their values
print(f"Hello, {name}! Welcome to learning Python.")

This code does three things:

Code Purpose
print("Hello, RUNOOB!") Prints a fixed greeting to the screen
input("Please enter your name: ") Displays a prompt on the screen, waits for the user to enter their name, and stores the input in the variable name after pressing Enter
print(f"Hello, {name}!...") Uses an f-string to embed the value of the variable name into the greeting, generating personalized output

PyCharm provides multiple ways to run your program. Choose any one:

Run Method Action
Right-click Menu Right-click anywhere in the editor area and select Run ‘hello’
Run Button Click the green triangle button in the upper right corner of the code editor area
Keyboard Shortcut Windows/Linux: Shift + F10, macOS: Ctrl + R

After running, the Run window will pop up at the bottom of PyCharm, displaying the program output:

Hello, RUNOOB!
Please enter your name: runoob
Hello, runoob! Welcome to learning Python.

Process finished with exit code 0

In the input area of the Run window, type your name and press Enter to see the personalized greeting.

If you see “No Python interpreter configured” when running, it means PyCharm cannot find the Python interpreter. Go to File → Settings → Project → Python Interpreter and manually specify the Python installation path to resolve this.


When using Python and PyCharm for the first time, the following are the four most common issues and their solutions.

Problem Symptom Possible Cause Solution
Command line python says “not recognized as an internal or external command” Add to PATH was not checked during installation Re-run the installer and check the option, or manually add the Python path to the system environment variables
PyCharm says it cannot find the interpreter PyCharm did not auto-detect Python Manually specify the path to the Python executable in File → Settings → Project → Python Interpreter
Running code produces no response or an error Indentation error or file not saved Check that indentation is consistent (Python strictly requires indentation), and confirm the file is saved (unsaved files have a dot marker next to the file name)
Chinese output is garbled File encoding is not UTF-8 Set the encoding to UTF-8 in File → Settings → Editor → File Encodings