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如下.
>>> 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的帮助,我可以解决这个问题.
将补丁应用于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)| 归档时间: |
|
| 查看次数: |
3295 次 |
| 最近记录: |