Pycharm adding new project interpreter makes dupli

2019-02-15 19:14发布

问题:

In PyCharm, whenever I try to add new Project Interpreters, two duplicated entries are created.

For example, after adding 2.7.10 python.exe, interpreter list contains two elements:

  • 2.7.10 (C:\Python27\python.exe)
  • 2.7.10 (C:\Python27\python.exe)(1)

Does anyone know how to fix this problem?

Thanks

回答1:

It seems to be some kind of bug in PyCharm.

As a workaround, you may remove duplicated entries manually. They are located in config file in PyCharm preferences directory. Default path is ~/.PyCharmxy/config/options/jdk.table.xml, where xy represents version (e.g. PyCharm40 for PyCharm 4.x).

Each <jdk> element represents single configured interpreter. To remove duplicates simply find elements with subelement <name value="your duplicate name"> and delete entire <jdk> tag.

Sample entry looks like below. (1) in name indicates duplicate.

<jdk version="2">
  <name value="Python 2.7.10 (C:\Python27\python.exe) (1)" />
  <type value="Python SDK" />
  <version value="Python 2.7.10" />
  <homePath value="C:\Python27\python.exe" />
  (...) // a lot of other fields
</jdk>

Answer is based on The mystery of PyCharm and duplicate interpreters blog post.



标签: pycharm