IPython没有找到Shell.IPShell类

pro*_*eek 8 python django ipython

安装Django后,我按照教程使用API​​.当我运行以下命令.

python manage.py shell
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息.

  File "/Library/Python/2.6/site-packages/django/core/management/commands/shell.py", 
  line 29, in handle_noargs
    shell = IPython.Shell.IPShell(argv=[])
  AttributeError: 'module' object has no attribute 'Shell'

我检查过我有Shell.py模块,里面有IPShell类.

/Library/Python/2.6/site-packages/IPython/Shell.py

class IPShell:
    """Create an IPython instance."""
Run Code Online (Sandbox Code Playgroud)

这有什么问题?我的IPython/Python/OS如下.

  • Mac OS X 10.6.5
  • Python 2.6.1
  • IPython版本0.10.1

添加

>>> import IPython
>>> IPython.Shell
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'module' object has no attribute 'Shell'
>>> print IPython.__file__
/Library/Python/2.6/site-packages/IPython/__init__.py

解决了

有了ma3和Ignacio的帮助,我可以解决这个问题.

  1. 删除site-package/IPython和site-package/ipython*.egg
  2. sudo easy_install ipython以全新安装IPython
  3. 将补丁应用于django的shell.py,因为Ignacio已链接.

        try:
            shell = IPython.InteractiveShell()
        except AttributeError:
            # IPython < 0.11
            # Explicitly pass an empty list as arguments, because otherwise IPython
            # would use sys.argv from this script.
            shell = IPython.Shell.IPShell(argv=[])
        shell.mainloop()
    
    Run Code Online (Sandbox Code Playgroud)

Ign*_*ams 7

一个变化是IPython的制作早在2009年即删除了此名8月19日,和Django的没有赶上呢.所以,Django bug.

编辑:

这里是.