相关疑难解决方法(0)

IPython没有找到Shell.IPShell类

安装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 …
    Run Code Online (Sandbox Code Playgroud)

python django ipython

8
推荐指数
1
解决办法
3295
查看次数

标签 统计

django ×1

ipython ×1

python ×1