SublimeCodeIntel自动完成失败,Pandas和Numpy

时间:2014-09-12 05:17:29

标签: python autocomplete pandas sublimetext3 sublimecodeintel

我正在尝试并且无法在Sublime Text 3中使用python进行自动完成。建议在多个博客和“设置”指南中使用Sublimecodeintel。当它工作时,它很棒,但我无法使用numpy或pandas,这是我最常用的两个包。

设置: Mac OS X 10.9.4 我使用Homebrew安装了python 2.7,numpy和pandas。 我正在使用sublime text 3,并使用包管理器安装了sublimecodeintel。

一个例子:

import pandas as pd
import matplotlib.pyplot as plt

fig = plt.figure() # autocomplete and tooltips works fine.

data = pd.read_csv('file.csv') # no autocomplete or tooltips.

自动填充选项和工具提示是在'。'之后的'plt'案例中的访问,然后当我开始在括号中写入时再次访问。 “pd”案件中没有任何事情发生。

我无法找到任何文档或之前的问题。在设置中有没有我错过的东西?我的配置路径中缺少什么?为什么自动完成不能使用我的包!?

配置文件和codintel.log跟随...

非常感谢提前。

我的sublimecodeintel配置文件:

{
    "Python": {
        "python": '/usr/local/bin/python',
        "pythonExtraPaths": [
            "/usr/local/lib/python2.7/site-packages",
            "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/",
            "/Library/Python/2.7/site-packages/",
            "/Library/Python/2.7/site-packages",
            "/usr/local/lib/python2.7/site-packages"
        ]
    }
}

codintel.log中的输出:

+ Info: processing `Python': please wait...
New env with catalogs for 'Python': PyWin32
Updating indexes for 'Python'... The first time this can take a while.
scan_purelang: path: '/Users/oscarbranson/UCDrive/Projects/APT/MassSpectrum/APT_MS_autorange.py' lang: Python
Python Syntax Error in '/Users/oscarbranson/UCDrive/Projects/APT/MassSpectrum/APT_MS_autorange.py': invalid syntax (<unknown>, line 9)
Doing CodeIntel for 'Python' (hold on)...
eval 'plt' at APT_MS_autorange.py#9  <Trigger 'python-complete-object-members' at 168 (explicit)>
start scope is (<Element 'scope' at 0x1066bdf50>, [])
find 'plt ...' starting at (<Element 'scope' at 0x1066bdf50>, []):
is blob 'matplotlib.pyplot' from <Python curdirlib>? no
is blob 'matplotlib.pyplot' from <Python extradirslib>? yes
imports:: setting reldirlib to: '/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib'
is 'plt' accessible on (<Element 'scope' at 0x1066bdf50>, [])? yes: <Element 'scope' at 0x1066aa7d0>
'plt' is <Element 'scope' at 0x1066aa7d0> on (<Element 'scope' at 0x1066aa7d0>, [])
is blob '__future__' from <Python reldirlib>? no
is blob '__future__' from <Python curdirlib>? no
is blob '__future__' from <Python extradirslib>? no
is blob '__future__' from <Python envlib>? no
is blob '__future__' from <Python sitelib>? no
is blob '__future__' from <Python cataloglib: PyWin32>? no
is blob '__future__' from <python-2.7 stdlib>? yes
#... big list here ...

done eval: success
Done 'Python' CodeIntel! Full CodeIntel took 10ms

Autocomplete called (Python) [calltips]
Updating indexes for 'Python'... The first time this can take a while.
scan_purelang: path: '/Users/oscarbranson/UCDrive/Projects/APT/MassSpectrum/APT_MS_autorange.py' lang: Python
Python Syntax Error in '/Users/oscarbranson/UCDrive/Projects/APT/MassSpectrum/APT_MS_autorange.py': invalid syntax (<unknown>, line 11)
Doing CodeIntel for 'Python' (hold on)...
eval 'pd' at APT_MS_autorange.py#27  <Trigger 'python-complete-object-members' at 500 (explicit)>
start scope is (<Element 'scope' at 0x107050de8>, [])
find 'pd ...' starting at (<Element 'scope' at 0x107050de8>, []):
is blob 'pandas' from <Python curdirlib>? no
is blob 'pandas' from <Python extradirslib>? yes
scan_purelang: path: '/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/compat/__init__.py' lang: Python
# ... big list here ...
done eval: success
Done 'Python' CodeIntel! Full CodeIntel took 411ms

1 个答案:

答案 0 :(得分:4)

我曾经推荐SublimeCodeIntel,尽管有这样的随机打嗝,直到我发现Anaconda。一旦你设置了(一个非常简短的过程),它就可以了。没有数据库可以初始化或损坏,它会在您添加新软件包时自动发现,它在后台运行时非常不引人注目......我无法说出足够多的好东西关于它。它使用JEDI自动完成模块等,并且快速准确。它自动确定哪些类型变量,并使用可在其上调用的适当方法和类填充完成。你可以让它完成参数完成,但这对我来说有点烦人,所以我把它关了。它无法做到的一件事是方法链,但没有什么是完美的。它还包括用于代码复杂性检查和linting的模块,这很好,但是我不需要它,并且只想在我想要lint的时候使用lint,所以我也关闭了它。

我强烈建议您尝试一下。除了方法链接,我对它非常满意,并且还没有回头。您可以做的一件很酷的事情是为项目文件中的"python_interpreter"设置分配不同的值,这样您就可以轻松使用virtualenvs,或者(就像我一样)为Python 2编码打开一个项目,为Python 3打开另一个项目

顺便说一句,我不是开发人员,与他/她无关:)