Installing IPython for Sublime Text 2's embedd

2019-05-03 21:04发布

问题:

I am trying to install the IpythonIntegration package in sublime,

I installed in a bash shell:

  1. the latest ipython
  2. pyzmq
  3. pyside

However, the sublime console still gives me an error of

Reloading plugin /home/areal/.config/sublime-text-2/Packages/User/ipython_repl.py
Traceback (most recent call last):
  File "./sublime_plugin.py", line 62, in reload_plugin
  File "./ipython_repl.py", line 13, in <module>
    from IPython.zmq.blockingkernelmanager import BlockingKernelManager
ImportError: No module named IPython.zmq.blockingkernelmanager

EDIT:
Even a import IPython won't work.

When in python console, import IPython and import zmq work, however:

from IPython.zmq.blockingkernelmanager import BlockingKernelManager

Fails with:

ImportError: No module named zmq.blockingkernelmanager

I have 0MQ 3.2 (also tried with 2.x), and latest PyZMQ. I am working with Python 2.7.2 on Ubuntu 11.10.

So in general I have 2 problems:

  1. No IPython in Sublime (I assume it is because sublime works with an embedded interpreter)
  2. No zmq module in IPython

回答1:

I am not using Ubuntu, but I meet similar issue in Mac OS X.

The reason why it success in standalone python and fail in sublime text 2 is : sublime text 2 is using python 2.6 defaultly, while you standalone python is 2.7.

To solve this, in my OS X, I create a soft link from 2.7 to 2.6, something like below:

cd /Library/Frameworks/Python.framework/Versions/
sudo mv 2.6 2.6-backup
ln -s 2.7 2.6

I think you can do same thing in Ubuntu.