django - extensions无法与iPython notebook一起工作



我使用的是Django 1.4.5,并且刚刚在虚拟环境中安装了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也可以正常工作。

谁能告诉我哪里出了问题?

谢谢!

我通过使用一个新的虚拟环境来解决这个问题,并确保我在其中安装了ippython,即:

pip install tornado
pip install pyzmq
pip install ipython
./manage.py shell_plus --notebook

除了用户[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也可以正常工作。

最新更新