我正在尝试并未能在 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”的情况下什么也没有发生。
我还没有找到任何文档或以前的问题。我在设置中错过了什么吗?我的配置路径中缺少什么吗?为什么自动完成不能与我的包一起使用!?
配置文件和 codeintel.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"
]
}
}
codeintel.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