IPython找不到Shell.IPShell类 [英] IPython doesn't find the Shell.IPShell class
问题描述
安装Django后,我按照教程播放API。当我运行以下命令。
After installing Django, I followed the tutorial Playing with the API. When I run the following command.
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'
我检查了我有Shell.py模块,里面有一个IPShell类。
I checked that I have Shell.py module, and IPShell class inside it.
/Library/Python/2.6/site-packages/IPython/Shell.py
/Library/Python/2.6/site-packages/IPython/Shell.py
class IPShell:
"""Create an IPython instance."""
这有什么问题?我的IPython / Python / OS如下。
What's wrong with this? My IPython/Python/OS is as follows.
- 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
SOLVED
使用ma3和Ignacio的帮助,我可以解决这个问题
SOLVED
With ma3 and Ignacio's help, I could solve this issue.
- 删除site-package / IPython和site-package / ipython * .egg
- sudo easy_install ipython新安装IPython
-
将修补程序应用于django的shell.py,作为Ignacio链接。
- Remove site-package/IPython and site-package/ipython*.egg
- sudo easy_install ipython to fresh install the IPython
Apply the patch to the django's shell.py as Ignacio linked.
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()
推荐答案
A 更改是在2009年8月19日发布的IPython,删除了这个名字,而Django还没有赶上。所以,Django bug。
A change was made to IPython back in August 19, 2009 that removed this name, and Django hasn't caught up yet. So, Django bug.
编辑:
And 这里是。
这篇关于IPython找不到Shell.IPShell类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!