如何让IntelliJ识别常见的Python模块? [英] How do I get IntelliJ to recognize common Python modules?
问题描述
我正在使用IntelliJ 10 IDEA Ultimate Edition。
I'm using IntelliJ 10 IDEA Ultimate Edition.
我创建了一个新文件Test.py,IntelliJ已正确切换到Python解析模式。 (我可以通过输入d来确认这一点,它会弹出def作为建议,正确点击标签会给我def:)
I've created a new file Test.py, and IntelliJ has correctly switched to Python parsing mode. (I can confirm this by typing "d", it pops up "def" as a suggestion, and hitting tab correctly gives me "def :")
然而,当我试试这个代码......
However, when I try this code...
import os
cwd = os.getcw <Ctrl-space>
发生两件事......
Two things happen....
- 我在os下面有一个下划线并且在它上面盘旋,给我一个未解析的参考'os'消息
- 我没有建议点击上方的Ctrl空间,当我期待看到getcwd时。
我假设这必须是因为我没有配置IntelliJ正确地处理python模块,但我不知道它是什么,我不知道。
I'm assuming that this must be a result of my not configuring IntelliJ properly in order to handle python modules, but I have no idea what it is I'm missing.
任何IntelliJ / Python用户能够帮助我吗?
Any IntelliJ/Python users able to help me out?
推荐答案
只需创建并添加Python SDK
Just create and add Python SDK
File -> Project Structure -> Project -> Project SDK -> new
并选择Python解释器的安装路径(对于
示例, C:\ Python26
在windows中, /usr/bin/python2.7
在Linux中)作为主路径。
and select the installation path of your Python interpreter (for
example, C:\Python26
in windows and /usr/bin/python2.7
in Linux) as the home path.
相关讨论: http://devnet.jetbrains.net/ thread / 286883
这篇关于如何让IntelliJ识别常见的Python模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!