我想在Pydev eclipse插件中使用IPython作为解释器。
我有IPython 0.10和Pydev 2.5.0,在linux上运行(opensuse)。
当我进入Pydev首选项并尝试设置IPython路径时(如本页所述:http://pydev.org/manual_101_interpreter.html),我收到以下错误
“找不到Python stdlib或没有.py文件找到stdlib”
ipython解释器在bash终端上工作正常,我从“ipython”命令获取路径。
有人可以帮助我吗?
谢谢!
interpreterInfo.py输出为:
python /home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc/interpreterInfo.py
<xml>
<version>2.7</version>
<executable>/usr/bin/python</executable>
<lib path="out">/home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/scikits.timeseries-0.91.3-py2.7-linux-x86_64.egg</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/distribute-0.6.19-py2.7.egg</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages/MeshPy-2011.1-py2.7-linux-x86_64.egg</lib>
<lib path="out">/data/dvp/python</lib>
<lib path="out">/home/mayet</lib>
<lib path="ins">/usr/lib/python27.zip</lib>
<lib path="ins">/usr/lib64/python2.7</lib>
<lib path="ins">/usr/lib64/python2.7/plat-linux2</lib>
<lib path="ins">/usr/lib64/python2.7/lib-tk</lib>
<lib path="ins">/usr/lib64/python2.7/lib-old</lib>
<lib path="ins">/usr/lib64/python2.7/lib-dynload</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/PIL</lib>
<lib path="ins">/usr/local/lib64/python2.7/site-packages</lib>
<lib path="ins">/usr/local/lib/python2.7/site-packages</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/gtk-2.0</lib>
<lib path="ins">/usr/lib/python2.7/site-packages</lib>
<lib path="ins">/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info</lib>
<lib path="ins">/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode</lib>
<forced_lib>__builtin__</forced_lib>
<forced_lib>__main__</forced_lib>
<forced_lib>_ast</forced_lib>
<forced_lib>_codecs</forced_lib>
<forced_lib>_sre</forced_lib>
<forced_lib>_symtable</forced_lib>
<forced_lib>_warnings</forced_lib>
<forced_lib>errno</forced_lib>
<forced_lib>exceptions</forced_lib>
<forced_lib>gc</forced_lib>
<forced_lib>imp</forced_lib>
<forced_lib>marshal</forced_lib>
<forced_lib>posix</forced_lib>
<forced_lib>pwd</forced_lib>
<forced_lib>signal</forced_lib>
<forced_lib>sys</forced_lib>
<forced_lib>thread</forced_lib>
<forced_lib>xxsubtype</forced_lib>
<forced_lib>zipimport</forced_lib>
</xml>Traceback (most recent call last):
File "/home/softs/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc/interpreterInfo.py", line 142, in <module>
raise RuntimeError('Ok, this is so that it shows the output (ugly hack for some platforms, so that it releases the output).')
RuntimeError: Ok, this is so that it shows the output (ugly hack for some platforms, so that it releases the output).
答案 0 :(得分:5)
这意味着在这些路径(xml标签)中都没有,PyDev可以找到Python库文件(例如threading.py或traceback.py等) - 请注意,如果只有.pyc文件,可能会发生这种情况也不是其中一个文件夹中的实际.py文件。)
或者您没有离开包含在解释器配置过程中选择的Python库的文件夹。
请注意,您并没有真正将'IPython'设置为解释器,您将Python本身设置为解释器,您可以安装IPython库以在交互式控制台中使用:http://pydev.org/manual_adv_interactive_console.html(但是来自您的当你指向configure / usr / bin / python时,看起来你正好这样做。
答案 1 :(得分:4)
要将Ipython作为默认shell,请执行以下操作:转到Window - &gt; Preferences - &gt; PyDev - &gt; Interactive Console。在Initial Interpreter Commands字段中添加以下两个命令:import IPython; IPython.Shell.IPShell()。mainloop()现在,每次启动控制台时,IPython都将默认启动。
注1:当然,您需要安装系统的IPy才能实现此功能 注2:解释器仍然会抱怨类似“In [1]:PyDev控制台:使用默认后端(IPython不可用)”,但这是因为它在您有机会导入IPython之前会自动打印它。
希望这有帮助!!再见!!
答案 2 :(得分:1)
除了@mr_endres提到的步骤之外,我还必须验证site-packages的路径。有文件夹,但结果是空的。
要验证正确的路径,您可以从终端启动ipython并执行以下操作(仅作为示例):
1. import numpy as np
2. np.__file__
返回:
'`/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages`/numpy/__init__.pyc'
然后我将'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages'添加到PYTHONPATH(在Eclipse中通过首选项) - &gt; PyDev-&gt; Interpreter - Python - &gt; PYTHON PATH部分中的新文件夹。)
答案 3 :(得分:0)
对我来说,以下两个步骤有效: 1)将“/usr/lib/python2.7/site-packages/”添加到PYTHONPATH 2)在Window-&gt; Preferences-&gt; PyDev-&gt; Interactive Console下启用“将控制台连接到变量调试视图”选项
奇怪的是,只有第二步IPython开始......