Django_extensions 无法与 iPython 笔记本一起使用

标签 django virtualenv ipython-notebook django-extensions

我正在使用 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 也能正常工作。

任何人都可以提出可能出了什么问题吗?

谢谢!

最佳答案

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

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

关于Django_extensions 无法与 iPython 笔记本一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16515084/

相关文章:

python - 使用 --target 安装的包的 pip freeze

python - Azure Functions : Exception while executing function: Functions. x <--- 结果:失败异常:ModuleNotFoundError:没有名为 '_cffi_backend' 的模块

ipython - NetworkX:如何用tex符号绘制标签节点/边?

python - 在 Jupyter 中支持 html 标签和从右到左的语言

javascript - 使用 django channel 将 webRTC 视频流发送到服务器

virtualenv - 使用 ansible 运行 mkvirtualenv

python - 为什么我不能得到这个简单的 Python 字典的键/值对?

pandas - IPython 笔记本 : What is the default encoding?

django - 如何将更改保存到docker

python - 如何创建包含两个不同查询集之和的表