3

我正在使用 Django 1.4.5,并且刚刚在 virtualenv 中安装了 django-extensions。我正在使用 Python 2.7.1。当我输入:

./manage.py shell_plus --notebook

我得到错误:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/.../lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Users/.../lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/.../lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/.../lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/.../lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/Users/.../lib/python2.7/site-packages/django_extensions/management/commands/shell_plus.py", line 140, in handle_noargs
    run_notebook()
  File "/Users/.../lib/python2.7/site-packages/django_extensions/management/commands/shell_plus.py", line 71, in run_notebook
    from IPython.frontend.html.notebook import notebookapp
ImportError: No module named IPython.frontend.html.notebook

如果没有该--notebook选项,它可以正常工作。此外,也ipython notebook可以正常工作。

谁能建议可能出了什么问题?

谢谢!

4

2 回答 2

2

我通过使用新的 virtualenv 解决了这个问题,并确保我已经在其中安装了 iPython,即:

pip install tornado
pip install pyzmq
pip install ipython
./manage.py shell_plus --notebook
于 2013-06-28T00:28:22.423 回答
0

除了上面说的用户[https://stackoverflow.com/users/905720/racing-tadpole](Racing Tadpole),我还得安装jinja2。

pip install jinja2

一种测试在 ipython notebook 上缺少 django shell_plus 的方法是尝试单独执行 ipython notebook。这样我就可以检测到所有丢失的库,比如 jinja2。

ipython notebook

如果这可行,那么 shell_plus --notebook 也可以使用的机会很高。

于 2014-03-13T12:06:32.170 回答