简体   繁体   English

Intellij IDEA的python插件问题

[英]Problems with python plugin for Intellij IDEA

I installed python plugin for Intellij IDEA. 我为Intellij IDEA安装了python插件。

  • IDEA version: 14.1.4 IDEA版本:14.1.4
  • Plugin version: 4.5.141.1624 插件版本:4.5.141.1624

I am on Windows 7 and I have installed python to C:\\Python34 . 我在Windows 7上,并且已经将python安装到C:\\Python34 Python is added to my PATH variable too. Python也添加到了我的PATH变量中。

When I edit python files on IDEA, it shows various errors in my python scripts. 当我在IDEA上编辑python文件时,它在python脚本中显示了各种错误。 Following are some of them. 以下是其中一些。

在此处输入图片说明

How can I get rid of these errors? 如何摆脱这些错误?

Here is my python console settings. 这是我的python控制台设置。 I cannot set a python interpreter. 我无法设置python解释器。 There's no items in the dropdown. 下拉列表中没有任何项目。

在此处输入图片说明

I had the similar problem when I did not define SDK for project during creation of python project. 在创建python项目的过程中未为项目定义SDK时,我遇到了类似的问题。 Unfortunately I could not find any option in settings to do so. 不幸的是,我在设置中找不到任何选项。 But I found some solution. 但是我找到了解决方案。 Maybe it is little bit work around but it worked for me. 也许有点解决,但对我有用。

  1. I just created new project by using File/New/Project 我刚刚使用文件/新建/项目创建了新项目
  2. I selected Python type of project and click New to define Project SDK (Unfortunately I could not post picture with example I am pretty new in SO) 我选择了Python类型的项目,然后单击“ 新建”以定义Project SDK(不幸的是,我无法发布带有示例的图片,因此我在SO中还很新

After that Idea configured itself in such way that in my old project I was also able to select this SDK. 在完成Idea的配置后,我在旧项目中也可以选择此SDK。 I tried to define such SDK by edition of settings file of IDEA but I was not able to do this in such way. 我试图通过IDEA设置文件的版本来定义这样的SDK,但是我无法以这种方式执行此操作。

After defining few SDK It is also possible to change it for one of your module even if you did not do this on the beginning. 定义少量SDK之后,即使您一开始没有这样做,也可以为其中一个模块进行更改。 You just need to: 您只需要:

  1. open configuration file for module module_name.iml file 打开模块module_name.iml文件的配置文件
  2. find there line <orderEntry type="inheritedJdk" /> 在那找到行<orderEntry type="inheritedJdk" />
  3. change it to description of on of Python SDK for example <orderEntry type="jdk" jdkName="Python 3.4.3 (F:\\Python34\\python.exe)" jdkType="Python SDK" /> 将其更改为对Python SDK的描述,例如<orderEntry type="jdk" jdkName="Python 3.4.3 (F:\\Python34\\python.exe)" jdkType="Python SDK" />

I hope that this will help. 我希望这会有所帮助。

I am using: InteliJ IDEA 14.1.4 我正在使用:InteliJ IDEA 14.1.4
Python Community Edition plugin version 4.5.2 141.106 Python Community Edition插件版本4.5.2 141.106
And python 3.4.3 和python 3.4.3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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