如何升级kernmagic以修复此ipython错误? [英] How do I upgrade kernmagic to fix this ipython error?

查看:119
本文介绍了如何升级kernmagic以修复此ipython错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级了我的Enthought Python发行版

I recently upgraded my Enthought Python distribution with

sudo easy_install -U ipython

但是,当我使用 ipython 命令启动ipython时,出现错误:

However, when I start up ipython with the ipython command, I get an error:

David-Faux-MacBook-Air:core davidfaux$ ipython
Python 2.7.2 |EPD 7.2-2 (32-bit)| (default, Sep  7 2011, 09:16:50) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
[TerminalIPythonApp] Error in loading extension: kernmagic
Check your config files in /Users/davidfaux/.ipython/profile_default
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/core/extensions.pyc in load_extension(self, module_str)
     90                 __import__(module_str)
     91         mod = sys.modules[module_str]
---> 92         return self._call_load_ipython_extension(mod)
     93 
     94     def unload_extension(self, module_str):

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/ipython-0.13.1-py2.7.egg/IPython/core/extensions.pyc in _call_load_ipython_extension(self, mod)
    122     def _call_load_ipython_extension(self, mod):
    123         if hasattr(mod, 'load_ipython_extension'):
--> 124             return mod.load_ipython_extension(self.shell)
    125 
    126     def _call_unload_ipython_extension(self, mod):

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/kernmagic/__init__.py in load_ipython_extension(ip)
     28 
     29 def load_ipython_extension(ip):
---> 30     activate(ip)
     31     activate_aliases(ip)

/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/kernmagic/__init__.py in activate(ip, *args)
     14             continue
     15         magic_name = name[len('magic_'):]
---> 16         ip.shell.define_magic(magic_name, getattr(mymagics, name))
     17 
     18 def activate_aliases(ip, *args):

AttributeError: 'TerminalInteractiveShell' object has no attribute 'shell'

我google了一下,我找到的很多帖子都说明了这一行一个ipython配置文件。

I googled around, and many posts I found said to comment out this line in an ipython configuration file.

c.TerminalIPythonApp.extensions = ['kernmagic']

我发现注释掉一个ipython文件是很粗略的......后来,我发现 kernmagic 使用ipython 解决了问题

I find it sketchy to comment out an ipython file though... later, I found that kernmagic fixed the issue with ipython.

如何在我的ipython发行版中升级 kernmagic 以便此错误消失?

How do I upgrade kernmagic in my ipython distribution so that this error goes away?

推荐答案

这对我有用:

hg clone https://bitbucket.org/robertkern/kernmagic
cd kernmagic
python setup.py build
python -c "import setuptools;execfile('setup.py')" bdist_egg
egginst dist/kernmagic-0.0.0-py2.7.egg

这篇关于如何升级kernmagic以修复此ipython错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆