iPython notebook on Mac OSX Yosemite: no module named jinja2, even if it's installed

时光总嘲笑我的痴心妄想 提交于 2020-01-23 11:49:36

问题


I am trying to run iPython notebook on OSX Yosemite. I have installed everything via

pip install ipython[all]

and I see

mattia:~ mattiaspeziali$ pip freeze
backports.ssl-match-hostname==3.4.0.2
certifi==14.5.14
docutils==0.12
gnureadline==6.3.3
ipython==2.3.1
Jinja2==2.7.3
MarkupSafe==0.23
nose==1.3.4
numpy==1.8.2
numpydoc==0.5
pandas==0.14.1
Pygments==2.0.1
pyzmq==14.4.1
Sphinx==1.2.3
tornado==4.0.2
vboxapi==1.0

However, jinja2 seems not installed properly:

    mattia:~ mattiaspeziali$ ipython notebook
Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 120, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 563, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/IPython/core/application.py", line 381, in initialize
    self.parse_command_line(argv)
  File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 475, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 406, in initialize_subcommand
    subapp = import_item(subapp)
  File "/Library/Python/2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
    module = __import__(package, fromlist=[obj])
  File "/Library/Python/2.7/site-packages/IPython/html/notebookapp.py", line 42, in <module>
    from jinja2 import Environment, FileSystemLoader
ImportError: No module named jinja2

I tried also to uninstall and re-install jinja2, but nothing changes. Any suggestion?

In addition:

mattia:~ mattiaspeziali$ which python /usr/local/bin/python

mattia:~ mattiaspeziali$ which ipython /usr/local/bin/ipython

mattia:~ mattiaspeziali$ which pip /usr/local/bin/pip


回答1:


Re-installing iPython solved the issue.




回答2:


I had the same trouble with jinja2+ipython[notebook]. It seems that jinja2 is not mandatory to run ipython terminal and it is not installed by default.

But you must install it before ipython to be able to open a notebook.



来源:https://stackoverflow.com/questions/27843950/ipython-notebook-on-mac-osx-yosemite-no-module-named-jinja2-even-if-its-insta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!