gpt4 book ai didi

ipython - 如何升级 kernmagic 以修复此 ipython 错误?

转载 作者:行者123 更新时间:2023-12-03 15:22:52 25 4
gpt4 key购买 nike

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

sudo easy_install -U ipython

但是,当我使用 ipython 启动 ipython 时命令,我收到一个错误:
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'

我搜索了一下,发现很多帖子都说在 ipython 配置文件中注释掉了这一行。
c.TerminalIPythonApp.extensions = ['kernmagic']

我发现注释掉一个 ipython 文件很粗略……后来,我发现 kernmagic fixed the issue与 ipython。

如何升级 kernmagic在我的 ipython 发行版中,这个错误会消失吗?

最佳答案

这对我有用:

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

关于ipython - 如何升级 kernmagic 以修复此 ipython 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14574587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com