IPython 无法在 Django shell 中工作

发布于 2024-08-18 20:08:20 字数 319 浏览 1 评论 0原文

我最近刚刚在 Mac OS X 10.6 (Snow Leopard) 上改用 64 位 Python 2.6.1。 IPython 不再与 Django 一起使用,但 IPython 可在命令行中工作。

错误说:

    shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'

我可以使用 ./manage.py --plain 选项,但这并不是真正的修复。非常感谢您的帮助!

I've just recently switched over to using 64-bit Python 2.6.1 on Mac OS X 10.6 (Snow Leopard). IPython won't work with Django anymore, but IPython works from the command-line.

The error says:

    shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'

I could use the ./manage.py --plain option, but it's not really a fix. Any help very gratefully received!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

So要识趣 2024-08-25 20:08:20

IPython 0.11 有一个不同的 API,最新的 Django 版本中对此进行了修复。

对于较旧的 Django 版本,您可以使用 IPython 0.10,它确实有效:

pip install ipython==0.10

IPython 0.11 has a different API, for which a fix exists in the last Django versions.

For older Django versions, you can use IPython 0.10, which does work:

pip install ipython==0.10
巡山小妖精 2024-08-25 20:08:20

当您从 Python 交互式控制台运行它时,这是否有效?

import IPython; IPython.Shell

Does this work when you run it from Python interactive console?

import IPython; IPython.Shell
香草可樂 2024-08-25 20:08:20

我遇到了同样的问题,并通过应用 Django bug 的补丁解决了这个问题。 - IPython 找不到 Shell.IPShell 类

I got the same problem, and solved this issue by applying the patches for the Django bug. - IPython doesn't find the Shell.IPShell class

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文