How to set default PyCharm interpreter?
Asked Answered
F

7

31

My PyCharm installation has two interpreters available:

  • Python 3.3.2 (/usr/bin/python3.3m)
  • Python 2.7.5 (/usr/bin/python2.7)

Whenever I open a new project it sets the interpreter to Python 3. Since I work mostly with 2.7, this means in most cases I have to reconfigure it. How do I change it to use 2.7 by default for new projects?

Update: After setting the default interpreter to Python 2.7.5 in File → Default Settings → Project Interpreter and removing the .idea/misc.xml file, the interpreter is now not set at all in misc.xml. Better than setting it to Python 3.3, but still...

Fusillade answered 30/10, 2013 at 10:0 Comment(2)
I can't see the File → Default Settings → Project Interpreter option in the newest version of Pycharm (2018.2). Do you know where to find this option now? Thanks.Charkha
@Charkha You'll want to write a new question for that. I don't even use PyCharm anymore.Fusillade
F
51

File | New Projects Setup | Settings for New Projects | Project Interpreter.

new projects

interpreter

This configuration sets the default interpreter for the new projects, note the Settings for New Projects menu, it's not the same as File | Settings which sets options for the current project.

If there is no open project, you can access this menu from the Welcome Screen (Customize | All settings):

all settings

Fates answered 30/10, 2013 at 10:52 Comment(11)
@GamesBrainiac, it's also possible to access default settings from the welcome screen.Fates
I want to set the default interpreter, not the project one.Fusillade
@l0b0, did you actually try what I've suggested? It sets the default interpreter for the new projects. Exactly what you were asking for: How do I change it to use 2.7 by default for new projects?.Fates
I want to change the default, as in, any new projects should use version 2.7 without any configuration changes. Setting the project interpreter sets it for a single project only, and has no effect on subsequent new projects.Fusillade
@l0b0, yes, after setting the default interpreter the way I've described above you can Open Directory with your files and exactly this interpreter will be used for the automatically created project. You can verify it yourself if you don't believe the words of JetBrains Support.Fates
I've set multiple projects to Python 2.7, and whenever I open another one which I haven't opened before it is set to Python 3.3.Fusillade
Double check you set it in the Default Settings, the settings dialog will have Template Project Settings. Is that true? jetbrains.com/pycharm/webhelp/…Fates
Using PyCharm 2017.1 on Mac, I set my default interpreter in the Default Settings and restarted, but when I make a new project it uses a different interpreter (a virtual environment I have configured). What can I do that actually works? Thanks.Maryjanemaryjo
I got the same problem as @LindsayWard using macCyrenaica
@Peipeiffer File | Other Settings | Settings for New Projects.Fates
@Trident thanks for your note, I've updated the answer. If it doesn't work for you, contact support at intellij-support.jetbrains.com/hc/requests/new or report a bug at youtrack.jetbrains.com/newIssue?project=PY.Fates
C
12

This has now changed in the newer versions of PyCharm (I've got 2018.2). It's now called Preferences for New Projects:

enter image description here

Charkha answered 22/10, 2018 at 11:55 Comment(2)
Now it is called as 'Settings for New Projects...'Jenelljenelle
...within the "Other Settings" tab (see the screenshot in BabarBaig's answer)Peipeiffer
N
6

enter image description here

New PyCharm versions in Windows have moved the New Project Settings to a new location. See image.
Full navigation: File > Other Settings > Settings for New Projects > Project Interpreter.

Narda answered 6/10, 2019 at 23:59 Comment(0)
T
1

I am using a Mac and I found that on the splash screen there were messages saying that one of the xml files in

/Library/Preferences/PyCharm2017.3/options/

could not be loaded. As a result a new one was created. When I looked at the files in this directory I found a number of the files were corrupted in some way and could not be viewed. I renamed all these to .OLD, restarted PyCharm and reset the defaults to the system interpreter in my case. This fixed my problem and PyCharm now defaults to the system interpreter.

Turnsole answered 26/3, 2018 at 3:8 Comment(0)
S
1

This has now changed again on the latest version of PyCharm. It is now File > New Project Settings > Settings for New Projects

Screenshot

Sebastiansebastiano answered 2/6, 2020 at 0:25 Comment(0)
P
0

if you want a default configuration, right click on the text and click run, this way it will automatically create a configuration for you.

Pinette answered 25/3, 2020 at 19:22 Comment(0)
T
-1

In PyCharm Professional version 2022.1 in Linux the setting is now in
File -> New Projects Setup -> Settings for New Projects....

enter image description here

Then in appeared window you can select needed interpreter. enter image description here

However, when I create a new project, PyCharm still creates it with python 3.6 for some reason.

Trident answered 28/4, 2022 at 3:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.