Pycharm ошибка интерпретатора python

I’m trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says «No Python interpreter selected». It has a drop down to select a interpreter, but the drop down is empty.

Etan Reisner's user avatar

Etan Reisner

77.4k8 gold badges105 silver badges148 bronze badges

asked Oct 28, 2013 at 21:36

Ted pottel's user avatar

Ted pottelTed pottel

6,84921 gold badges75 silver badges134 bronze badges

3

Your problem probably is that you haven’t installed python. Meaning that, if you are using Windows, you have not downloaded the installer for Windows, that you can find on the official Python website.

In case you have, chances are that PyCharm cannot find your Python installation because its not in the default location, which is usually C:Python27 or C:Python33 (for me at least).

So, if you have installed Python and it still gives this error, then there can be two things that have happened:

  1. You use a virtualenv and that virtualenv has been deleted or the filepath changed. In this case, you will have to find proceed to the next part of this answer.
  2. Your python installation is not in its default place, in which case you will need to find its location, and locate the python.exe file.

Once you have located the necessary binaries, you will need to tell PyCharm were to look:

  1. Open your settings dialogue CTRL + ALT + S
  2. Then you will need to type in interpreter in the search box:

    enter image description here

  3. As you can see above, you will need to go to Project Interpreter and then go to Python Interpreter. The location has been selected for you in the above image.

  4. To the side you will see a couple of options as icons, click the big + icon, then click on local, because your interpreter is on this computer.

  5. This will open up a dialogue box. Make sure to select the python.exe file of that directory, do not give pycharm the whole directory. It just wants the interpreter.

Tony Adams's user avatar

Tony Adams

6911 gold badge9 silver badges29 bronze badges

answered Oct 30, 2013 at 8:08

Games Brainiac's user avatar

Games BrainiacGames Brainiac

79.8k33 gold badges140 silver badges199 bronze badges

6

Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters

There will be a «+» sign on the right side. Navigate to your python binary, PyCharm will figure out the rest.

answered Oct 29, 2013 at 7:19

jaor's user avatar

3

This situation occurred to me when I uninstalled a method and tried to reinstall it. My very same interpreter, which worked before, suddenly stopped working. And this error occurred.

I tried restarting my PC, reinstalling Pycharm, invalidating caches, nothing worked.

Then I went here to reinstall the interpreter:
https://www.python.org/downloads/

When you install it, there’s an option to fix the python.exe interpreter. Click that. My IDE went back to normal working conditions.

answered Oct 6, 2016 at 6:38

AeFinches's user avatar

During the install of python make sure you have «Install for all users» selected.
Uninstall python and do a custom install and check «Install for all users».

answered Sep 18, 2016 at 13:40

user6845508's user avatar

for mac I can tell you that first you have to check your path

by executing this command

which python or which python3

check where python is installed

then you have to configure it in your pycharm.

pycharm—>preferences—>gear button—>add..

enter image description here

click on system interpreter—> then on

then you search where your python version is installed

enter image description here

once it is done then you have to configure for your project

click on edit configuration

enter image description here

then choose the python interpreter

enter image description here

answered Jan 5, 2021 at 11:09

bizimunda's user avatar

bizimundabizimunda

7792 gold badges7 silver badges25 bronze badges

Even I got the same issue and my mistake was that I didn’t download python MSI file. You will get it here: https://www.python.org/downloads/

Once you download the msi, run the setup and that will solve the problem. After that you can go to File->Settings->Project Settings->Project Interpreter->Python Interpreters

and select the python.exe file. (This file will be available at c:Python34)
Select the python.exe file. That’s it.

answered Dec 15, 2017 at 10:11

Darshan Jain's user avatar

If you are using Ubuntu, Python has already been downloaded on your PC.
so, go to -> ctrl + alt + s -> search interpreter -> go to project interpreter than select Python 3.6 in the dropdown menu.

Edit: If there is no Python interpreter in drop-down menu, you should click the gear icon that on the right of the drop-down menu —> add —> select an interpreter.

(on PyCharm 2018.2.4 Community Edition)

answered Jul 5, 2018 at 23:49

bayramcicek's user avatar

bayramcicekbayramcicek

1832 silver badges9 bronze badges

I got the same issue when i newly installed pycharm in my windows 10 machine.

  • download python setup

  • install this solved my problem.

for more help visit
goodluck

During the install of python make sure you have «Install for all users» selected. Uninstall python and do a custom install and check «Install for all users»

answered Dec 2, 2018 at 19:29

Arslan Ahmad khan's user avatar

In my case, there are several interpreters, but I have to manually add them.

To the right of where you see «No Interpreters», there is a gear icon. Click the gear icon -> Click «Add…», then you can add the ones you need.

answered Nov 24, 2019 at 6:10

Egret's user avatar

EgretEgret

4211 gold badge3 silver badges13 bronze badges

In Linux, it was solved by opening PyCharm from the terminal and leaving it open. After that, I was able to choose the correct interpreter in preferences. In my case, linked to a virtual environment (venv).

10 Rep's user avatar

10 Rep

2,2177 gold badges19 silver badges32 bronze badges

answered Jul 22, 2020 at 4:54

Luck547's user avatar

0

I has to close PyCharm, delete the .idea folder then open PyCharm again.

answered Nov 17, 2022 at 12:23

Nicu Tofan's user avatar

Nicu TofanNicu Tofan

1,04214 silver badges34 bronze badges

You don’t have Python Interpreter installed on your machine whereas Pycharm is looking for a Python interpreter, just go to https://www.python.org/downloads/
and download python and then create a new project, you’ll be all set!

answered Feb 17, 2018 at 16:38

Nandan Kulkarni's user avatar

I had the same problem and stumbled onto this solution.
I ran PyCharm (as administrator, though not sure if necessary).
After PyCharm has completely loaded (green tick mark top right), see bottom right. Click on it.
An interface will open. In my case the path was already there. I just clicked OK and all was fine.
closed PyCharm and ran it again normally. Still all fine.

answered Sep 18, 2021 at 10:20

shottootto's user avatar

1

I’m new to programming and just started a course on Python. I want to use PyCharm, so I downloaded and intalled it (v. 4.5, community edition). I had previously installed Python 3.5 64-bit from python.org (I’m using Windows 10).

To start using PyCharm, I need a project interpreter, which I can select in the settings. As far as I’m concerned, the interpreter is «py.exe», but when I select it, I get this error message: «The selected file is not a valid home for Python SDK». I also tried to use every file whose name contained «python» or «py», and failed.

On every website and video I see, they select a file called «python.exe», but they’re using Python 3.4 or a previous version. I checked that PyCharm supports 3.5 («Initial support for Python 3.5»).

Is there anything I’m doing wrong? What should I do to be able to use PyCharm?

All replies are appreciated. Thanks in advance.

asked Sep 28, 2015 at 21:23

Asier R.'s user avatar

file > new project settings > project Interpreter > click in the drop down and select ‘show all’ > click the ‘+’ button >

Now, in the Virtualenv Environment tab under the New environment radio button, check the path in the ‘Base interpreter:’ field. For me, mine was set to an invalid path. Once I had corrected the path to point to python.exe I recreated my new project and PyCharm built the virtualenv.

For me there was a bit more too…. When creating the new project I expanded the drop down and had to verify the directory where the venv directory was being created. Once I had corrected the path here I had to click around a bit to get it to let me create the project.

I’m going to chaulk this up to a bug. I’m using Community edition.

answered Apr 22, 2019 at 15:37

DonkeyKong's user avatar

DonkeyKongDonkeyKong

98513 silver badges18 bronze badges

When creating a project in PyCharm, if the interpret is not already selected, in the drop down menu under the projects «Location:», you can click the gear-looking icon to the right of the interpreter option, and click «Add Local»; then select the file location of the python.exe file that you have installed. It will probably be C:Python35Python.exe

answered Sep 28, 2015 at 21:38

xponent's user avatar

xponentxponent

1512 gold badges2 silver badges10 bronze badges

2

I faced a Similar issue and was not able to find Python interpreter anywhere on the system.

The problem with it was that python was installed directly with default settings and there was no exe found in

C:Python35 

and to solve this i tried uninstalling and reinstalling with custom settings and selecting allow for all users as well which did the trick and path was set correctly to

C:Python35python.exe.

After whichPycharm was able to detect the interpreter on this path.

Sanoop Surendran's user avatar

answered Sep 5, 2016 at 6:05

Anmol G's user avatar

PyCharm project interpreter problem Resolved
I installed anaconda python distribution (Anaconda3-5.0.1-Windows-x86_64.exe) from the anaconda website. https://anaconda.org/anaconda/python
What it actually did was it re-installed my Python3.6.3 (pertinent to mention I have windows10, with pyCharm community & python 3.5 already but with the interpreter problem and while installing anaconda I chose the following settings and disabled my antivirus before my anaconda installation):

  1. selecting allow for all users
  2. installation path was set correctly and (stored safely for future)
  3. restart my Computer after installation.(not essential-but I did)
  4. opened Anaconda & Jet brian pycharm
  5. selected new project in PyCharm screen shot of my New project default Python interpreter location = C:UsersSkboyPycharmProjectsdani Interpreter = C:UsersSkboyAppDataLocalProgramsPythonPython36-32python.exe

Wow! my pyCharm started working for me,

Resolution : Python6.3 re-installation with proper custom setting

make a python test test1.py program file to print «hello python test world»

Run

now my Python Interpreter(automatically -by default select) Python 3.6.3
edit configuration & check for interpreter

(C:Usersuser1AppDataLocalProgramsPythonPython36-32python.exe)

Run
success test Run
worth to mention Anaconda Jupyter is a web based can also be used in case novice user are still having problems

JohnS's user avatar

JohnS

1,1821 gold badge11 silver badges22 bronze badges

answered Dec 6, 2017 at 17:54

Waseem A's user avatar

I have had the exact same problem and was unable to find the solution until just now. Hopefully this works for anyone that was struggling with it.

I went to the location of the Python 3.5 (32-Bit) in my C: Drive which it turns out is just a shortcut to the actual Python application, right click on it and select Open file location which should direct you to the application version of python — simply called ‘python’. This is the .exe file that PyCharm was looking for to use as the interpreter.

Now go to the configure interpreter menu in Pycharm and type in the file location of the actual python application. To get to mine I had to go to AppData/Local/Programs/Python/Python35-32. Click on the python.exe file and it should work.

This is my first post here so if its formatted incorrectly or doesn’t use the conventional terms — sorry. Let me know if the solution worked for anyone else with the problem or if I fluked it.

answered Jul 10, 2016 at 14:54

Ben Sharman's user avatar

If you kept the default settings while installing python, Your project interpreter for PyCharm will be:

C:UsersyourUserNameAppDataLocalProgramsPythonPython36python.exe

Chose the above location as your project interpreter inside PyCharm.

Depending on which python version you have, it could be either Python36python.exe or Python35python.exe.

answered Oct 15, 2016 at 14:30

Haris Ghauri's user avatar

Haris GhauriHaris Ghauri

5472 gold badges7 silver badges27 bronze badges

For me the following solution it worked:

My configuration:
Pycharm Community edition 2019.1.1
Anaconda distribution with python 3.7. Interpreter in standard location.

Problem:
Pycharm was not able to find python interpreter after reinstallation of anaconda distribution.

Solution:
— Make sure you run pycharm as admin (right click and run as admin). This was actually the critical step.
— Create new project (or open an existing one)
— Depending on the choice choose interpter or go to file > settings > project interpreter > choose small gear on rights side > add > on base interpreter choose the 3 dots > paste the location of the interpreter in the anaconda distribution.

Hope it helped someone. For me the blocking point was that for some reason pycharm was not launching with admin rights.

Blockquote

answered Oct 14, 2019 at 11:03

CVname's user avatar

CVnameCVname

3373 silver badges12 bronze badges

In any stage, while doing python programming in Pycharm, we can encounter this error — “No python interpreter configured for this project.”

This error usually occurs when you are programming in Python and particularly using PyCharm IDE. To solve this error first you have to know what is Python and PyCharm.

Python is an interpreter that can be used to execute the python code

PyCharm is an integrated development environment used in computer programming, especially for the Python programming language(though other languages are also supported) that can display the output of your python programs in the console with the help of the installed python interpreter. PyCharm provides some best features to its users and developers in the following aspects.

  • Code completion and inspection
  • Advanced debugging
  • Support for web programming and frameworks such as Django and Flask.

Now let’s come back to the solution.

Step 1: In the PyCharm window you can see the option of “Configure Python Interpreter” in the upper right corner.

Step 2: Click on this «Configure python interpreter» option. A settings window will appear in which the project interpreter will open.

You can also open a Project interpreter from the File option.

Go to File -> Settings -> Project -> Project Interpreter.

Step 3: In the “Project Interpreter” menu, you will get an option of selecting the project interpreter. I have a Python 3.6 project interpreter option because I am working with Python 3.6. Sometimes, there will be no option for a project interpreter. The reason can be either you have not installed python or your PyCharm is unable to locate a valid Python interpreter.

Step 4: Sometmies, you will not see a python interpretor in the dropdown, which means we need to guide pyhcharm on where the python interpreter is installed. To solve for this problem you can simply click on the “gear icon”.

Step 5: Click on “Add”.

Step 6: After this click on the “Existing Environment”.

Step 7: Then click on the “triple-dot” icon to locate python on your computer.

Note: You can follow the above steps only if you have installed python on your computer.

Step 8: If you don’t have Python then download and install it.

Now how to download and install python?

  • Go to “Google Chrome”.
  • Write “python install”.

You will find the home page of python.org. Here click on “Download Python 3.6.5” to download python.

Download the python interpreter and install it.

Step 9: 90% of the times, a python interpreter can be located automatically as was in my case. If you are able to find the python interpreter option in the dropdown, select and click on it.

Step 10: Click on the “Apply” button.

Step 11: Click “Ok”.

Now you can see that error is gone and you can happily work with your pycharm.

Step 12: After this, run any of your programs and the corresponding output will show up in the console.

I hope this article was helpful and you were able solve your error. Happy Coding!

You can also watch the following video if any of the above-mentioned steps are unclear. I am 100% sure that you will be able to solve error after following the instructions given in this article.

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.

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

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

In Add Python Interpreter window, you can create a new virtual Python environment. My project is under C:abcstudyguidepython 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:PythonPython39 directory on my computer. However, default installation path is C:Users{YourUserName}AppDataLocalProgramsPython.

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:PythonPython39python.exe).

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.

While working with PyCharm, you might encounter some warning or error messages. This chapter provides the list of the known problem solutions and workarounds.

You can also find the recommendations for troubleshooting and performing basic diagnostics of your working environment.

  • Project Settings

  • Code Editing

  • Code Completion

  • Debugging

  • Cython Speedups

  • Packaging

  • Docker

  • File Watchers

  • Deployment

  • Profiler

  • Troubleshooting Tips

  • Performance problems

Reported Problem

Possible cause

Solution

Project Settings

A Python interpreter is marked as unsupported in the list of available interpreters in .

The Python version of the marked interpreter is outdated and it is not supported in PyCharm

You can delete the unsupported interpreter from the list of the available interpreters. For more information about the supported Python versions, see Python Support.

Code Editing

PyCharm Editor restricts code editing.

You have installed the IdeaVim plugin and thus enabled the vim editing mode.

Deselect Vim Emulator on the menu. See Using Vim Editor Emulation in PyCharm for more details.

Python code is not highlighted in the Editor.

The PY files are associated with the text file format.

In the Settings dialog (Ctrl+Alt+S), navigate to , select Text from the Recognized File Type list, select *.py from the File Name Patterns list, and click Remove.

Code Completion

Code completion action is not available.

Power Save Mode is enabled.

From the main menu, choose File and clear the Power Save Mode checkbox.

Your file doesn’t reside in a content root , so it doesn’t get the required class definitions and resources needed for code completion.

Restructure your sources files.

A file containing classes and functions that you want to appear in the completion suggestions list is a plain text file.

Reconsider and modify (if needed) the format of your source files.

Debugging

Cannot debug a Docker run/debug configuration; the Debug action is not available.

PyCharm provides debugging for Python run/debug configurations.

Configure a Docker-based interpreter and debug your Python script in a Docker container.

Python Debugger hangs when debugging Gevent code.

Gevent compatibility mode is not enabled.

In the Settings dialog (Ctrl+Alt+S), navigate to and select the Gevent compatible checkbox.

Some import errors are reported in your PyQt code.

PyQt is installed on the interpreter but is not imported in the application code.

In the Settings dialog (Ctrl+Alt+S), navigate to , and clear the PyQt compatible checkbox in the . This mode is enabled by default.

Debugging process is slow.

Debugger stops not only when the process terminates with an exception but on each exception thrown (even though it was caught and didn’t lead to the process termination).

Clear the On raise checkbox in the Breakpoints dialog ().

The following error message appears on your first attempt to attach to a local process: ptrace: Operation not permitted.

It a known issue for Ubuntu.

Ensure that the kernel.yama.ptrace_scope kernel parameter is set to 0. You can temporary change its value with the command sudo sysctl kernel.yama.ptrace_scope=0 or set it permanently by adding the kernel.yama.ptrace_scope = 0 line to the /etc/sysctl.d/10-ptrace.conf file.

Cython Speedups

The following error message is shown:

Python.h: no such file or directory.

You lack header files and static libraries for Python.

Use your package manager to install the python-dev package system-wide.

On Linux and macOS, you can run the following command:

sudo apt-get install python-dev

To install the package for specific Python version, use python-dev<version>. For example:

sudo apt-get install python3.11-dev

The following error message is shown:

Command 'gcc' failed with exit status 1.

You lack a C compiler.

Install a C compiler in order to build Cython extensions for the debugger. For more information, refer to the Cython documentation.

You have already clicked the Install link in the Cython speedup extensions notification but PyCharm repeatedly prompts to install it.

You do not have permissions to write in the directories used by PyCharm.

Check and modify your permissions.

Packaging

Package installation fails.

pip is not available for a particular Python interpreter, or any of the installation requirements is not met.

  • If pip is not available, install it for the required Python interpreter (see the corresponding troubleshooting tip)

  • Consult product documentation for a specific package to ensure that it can be installed in your operating system and for the target Python interpreter. Also, check if any additional system requirements should be met.

Docker (see Docker troubleshooting)

File Watchers You might notice the following messages in the window.

Unknown Scope error

The File Watcher uses a scope that is not defined in this project.

Double-click the watcher and select an available scope or create a new one.

Not found error

The project uses a global File Watcher that was removed.

Delete the watcher from the list using the Remove button Remove or edit it to create a new global watcher with the same name.

Deployment

Error message when using SSH configurations:

Connection to <server> failed: SSH: invalid privatekey: [<key>. SSH: invalid privatekey: <key>

The RFC 4716 format for OpenSSH keys is not supported by PyCharm.

  • Add the private keys to ssh-agent using the ssh-add command (see more details at ssh.com)

  • Repeat the configuration step in the Add Python interpreter dialog.

  • Add the private keys to ssh-agent using the ssh-add command (see more details at ssh.com)

  • In the Settings dialog (Ctrl+Alt+S), select , then select your SFTP deployment configuration.

    Choose OpenSSH Config and authentication agent in the Authentication list.

The Profile command is not available in the Run menu.

  • This functionality is available only in the Professional edition of PyCharm.

  • The Diagrams plugin that is bundled with PyCharm Professional has been disabled.

Check the edition of PyCharm and enable the Diagrams plugin in the plugin settings.

In some cases, you might need to perform diagnostic steps to identify whether the problem occurs in PyCharm or in your working environment. Below is the list of the useful tips and tricks.

Troubleshooting Tips

Troubleshooting case

Diagnostic action

You are experiencing different behavior of your application when running it in PyCharm and in the Terminal window.

Run your script with the python version specified in the PyCharm project settings:

  1. In PyCharm, open the Settings dialog Ctrl+Alt+S, navigate to .

  2. Click Interpreter nearby the Python Interpreter field and select Show All…. The interpreter you use in your project will be selected in the list of the available interpreters.

  3. Click Edit interpreter and copy the path from the Interpreter path field.

  4. Now, run your script in the Terminal window using the copied path

    <copied python interpreter path> <path to the python script>my_script.py. For example, C:Python27python.exe C:Samplesmy_script.py

  1. In PyCharm, open the Preferences dialog Ctrl+Alt+S, navigate to .

  2. Click Interpreter next to the Python Interpreter field and select Show All…. The interpreter you use in your project will be selected in the list of the available interpreters.

  3. Click Edit interpreter and copy the path from the Interpreter path field.

  4. Now, run your script in the Terminal window using the copied path

    <copied python interpreter path> <path to the python script>/my_script.py. For example, /Users/jetbrains/bin/python3 /Users/jetbrains/Samples/my_script.py

If the behavior of your application still differs, contact the support service pycharm-support@jetbrains.com

The required package is not installed for a particular Python interpreter. A version of the package installed for a particular Python interpreter is outdated.

Run the following commands to install the required package:

<path to the python executable>python.exe -mpip install '<package>'

For example, C:Python27python.exe -mpip install 'Flask'

Once executed, these commands install the latest versions of the specified packages.

To install a particular version of the package, use the following expressions:

  • '<package>==<package_version>' – installs a specific version of the package

  • '<package>>=<package_version>' – installs a greater than the specified or later version of the package

  • '<package>~=<package_version>' – installs a version that is compatible with the specified version of the package

For example, the following command installs Flask compatible with the version 1.0.2: C:Python27python.exe -mpip install 'Flask~=1.0.2'

<path to the python executable/python -mpip install '<package>'

For example, /Users/jetbrains/anaconda3/bin/python -mpip install 'Flask'

Once executed, these commands install the latest versions of the specified packages.

To install a particular version of the package, use the following expressions:

  • '<package>==<package_version>' – installs a specific version of the package

  • '<package>>=<package_version>' – installs a greater than the specified or later version of the package

  • '<package>~=<package_version>' – installs a version that is compatible with the specified version of the package

For example, the following command installs Flask compatible with the version 1.0.2: /Users/jetbrains/anaconda3/bin/python -mpip install 'Flask~=1.0.2'

When trying to install a package, you discover that pip is not available for a particular Python interpreter.

Try to bootstrap pip from the standard library:

<path to the python executable>python.exe -m ensurepip --default-pip

For example, C:Python27python.exe -m ensurepip --default-pip

<path to the python executable/python -m ensurepip --default-pip

For example, /Users/jetbrains/anaconda3/bin/python -m ensurepip --default-pip

For more information about pip installation, refer to packaging.python.org

Last modified: 17 March 2023

  • Python try except как вывести ошибку
  • Pycharm ошибка traceback most recent call last
  • Python try except вывод ошибки
  • Pxn 9613 ошибка драйвера
  • Python try except все ошибки