Khắc phục lỗi no python interpreter configured for the project

To work with your Python code in PyCharm, you need to configure at least one interpreter. A system interpreter is the one that comes with your Python installation. You can use it solely for all Python scripts or take it as a base interpreter for Python virtual environments.

Configure a system interpreter

  • Ensure that you have downloaded and installed Python on your computer. Installing Python on Windows from Microsoft Store If you are on Windows, you can download Python from the Microsoft Store and install it as a Python interpreter. Once the Python application is downloaded from the Microsoft Store, it becomes available in the list of the Python executables. Note that interpreters added from the Microsoft Store installations come with some limitations. Because of restrictions on Microsoft Store apps, Python scripts may not have full write access to shared locations such as TEMP and the registry.
  • Do one of the following:
  • Click the and choose Add New Interpreter.
  • Press Control+Alt+S to open Settings and go to . Click the Add Interpreter link next to the list of the available interpreters.
  • Click the and choose Interpreter Settings. Click the Add Interpreter link next to the list of the available interpreters.
  • Select Add Local Interpreter.
  • In the left-hand pane of the Add Python Interpreter dialog, select System Interpreter.
    Khắc phục lỗi no python interpreter configured for the project

In the Interpreter drop-down, select one of the Python interpreters that have been installed in your system, or click and in the Select Python Interpreter dialog that opens, choose the desired Python executable.

Khắc phục lỗi no python interpreter configured for the project

You will need admin privileges to install, remove, and upgrade packages for the system interpreter. When attempting to install an interpreter package through an intention action, you might receive the following error message:

No python interpreter configured for the project is a common error message you may encounter in PyCharm. PyCharm is a very useful editor having nice features like debugging, testing, refactoring and code completion. However, it needs an external interpreter (Python.exe) to run Python code.

This message tells you that project configuration should be updated to use a valid Python installation. To open the related configuration, you can click on Configure Python interpreter link as shown below. Or alternatively, you can select File -> Settings from the menu and open Project -> Python Interpreter setting.

Khắc phục lỗi no python interpreter configured for the project

Python Interpreter setting shows that is selected for the project. To select (or create) a Python.exe interpreter click on Gear icon and select Show All… option.

Khắc phục lỗi no python interpreter configured for the project

In the Python Interpreters window that opens, the list is empty. To add a new Python Interpreter click on Plus (+) icon.

Khắc phục lỗi no python interpreter configured for the project

In Add Python Interpreter window, you can create a new virtual Python environment. My project is under C:\abcstudyguide\python directory, so I have created a folder venv under this directory to create a new virtual environment for my project.

You must then choose a Base interpreter. Base interpreter is the python.exe file installed on your system. When you create a virtual environment, it will be based on Python version specified here. If you need a specific version of Python (like 3.8, 3.7), you need show path of this Python version in Base interpreter filed.

If you don’t have Python installed on your system yet, you can download it from https://www.python.org/downloads/. Note that I installed Python in C:\Python\Python39 directory on my computer. However, default installation path is C:\Users{YourUserName}\AppData\Local\Programs\Python.

Khắc phục lỗi no python interpreter configured for the project

Virtual Environments in Python Instead of creating a new virtual environment, you can also use the System Interpreter, but this method is not recommended.

You can work on many different Python projects. Virtual environments are useful for creating an isolated environment for each Python project. Consider you are working on two different projects (ProjectA and ProjectB). Both projects are using the same library (LibraryX) but they require different versions of LibraryX. ProjectA needs version 1.0 of LibraryX, ProjectB needs version 2.0.

To avoid version conflicts between third party libraries, each project should create and use its own virtual environment instead of using System Interpreter (C:\Python\Python39\python.exe).

Khắc phục lỗi no python interpreter configured for the project

When you create a new Python virtual environment and select it as Python Interpreter in your project settings, No python interpreter configured for the project message will be gone.