简体   繁体   中英

How to set default PyCharm interpreter?

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...

File | Default Settings | Project Interpreter .

This configuration sets the default interpreter for the new projects, note the Default Settings 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 ( Configure | Settings ).

Please note that it affects Open Directory option. Once you open a directory with your files, a new project will be created with the default interpreter that you have configured using the above steps. New Project option will show you the list of configured interpreters in default order and you will have to choose which one to use. There is a related request to suggest the most frequently used interpreter first.

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

在此处输入图片说明

在此处输入图片说明

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.

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.

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

Screenshot

如果您想要默认配置,请右键单击文本并单击运行,这样它会自动为您创建配置。

你必须进入控制面板>卸载程序>pycharm 2020.2>卸载

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM