Python 伊皮顿没有';找不到Shell.IPShell类

Python 伊皮顿没有';找不到Shell.IPShell类,python,django,ipython,Python,Django,Ipython,安装Django之后,我继续使用API。当我运行以下命令时 python manage.py shell 我收到了这个错误信息 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' obj

安装Django之后,我继续使用API。当我运行以下命令时

python manage.py shell
我收到了这个错误信息

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' 这个怎么了?我的IPython/Python/OS如下所示

  • Mac OS X 10.6.5
  • Python 2.6.1
  • IPython版本0.10.1
补充 >>>进口伊皮顿 >>>伊皮顿,贝壳 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 AttributeError:“module”对象没有属性“Shell” >>>打印IPython.\u文件__ /Library/Python/2.6/site-packages/IPython/_-init__;u.py 解决了的 在ma3和Ignacio的帮助下,我可以解决这个问题

  • 删除站点包/IPython和站点包/IPython*.egg
  • sudo easy_install ipython可重新安装ipython
  • 以Ignacio链接的方式将修补程序应用于django的shell.py

        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()
    
    试试看:
    shell=IPython.InteractiveShell()
    除属性错误外:
    #IPython<0.11
    #显式地将空列表作为参数传递,否则为IPython
    #将使用此脚本中的sys.argv。
    shell=IPython.shell.IPShell(argv=[])
    shell.mainloop()
    
  • 早在2009年8月19日,IPython就收到了删除这个名字的通知,Django还没有赶上。那么,Django bug

    编辑:


    并且。

    对于IPython 0.11.dev,需要修复以下问题:

    from IPython.frontend.terminal.ipapp import IPythonApp
    app = IPythonApp(argv=[])
    app.start()
    

    以下是GitHub django extensions repo的官方承诺:

    您可以通过执行以下操作来安装它:

    $ git clone git://github.com/django-extensions/django-extensions.git
    $ cd django-extensions
    $ python setup.py install 
    

    你是如何安装Python的?这不是python安装的标准目录。@ma3:我没有安装python,在Mac上,python是预安装的。好的,您使用的是操作系统的python 2.6。你是如何安装IPython的?我有OSX 10.6.5、Python 2.6、IPython 0.10.1,我的
    \uuuu init\uuuuu.py
    文件与您的非常不同。您的源代码看起来可能来自IPython 0.11分支。@ma3:好的,下载源代码,然后运行“python setup.py install”。0.10.1的源代码是什么?还是对于仍在开发中但尚未完成的0.11分支?为什么不简单地
    轻松安装ipython
    ?这将使您获得最新的稳定版本0.10.1。正如我在问题中补充的那样。那么,我不应该直接运行IPython.Shell吗?正确。该名称已不存在。将bug报告中的修复程序之一应用于Django源代码。
    from IPython.frontend.terminal.ipapp import IPythonApp
    app = IPythonApp(argv=[])
    app.start()
    
    $ git clone git://github.com/django-extensions/django-extensions.git
    $ cd django-extensions
    $ python setup.py install