This question already has answers here:
ImportError: No module named jinja2
                                
                                    (5个答案)
                                
                        
                                5年前关闭。
            
                    
我按照他们的说明安装了ipython笔记本。那没用。所以我尝试了其他指示。我似乎更接近使它起作用。目前,这是我尝试运行ipnotebook时得到的输出。

    Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 9, in <module>
    load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 544, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/terminal/ipapp.py", line 312, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/core/application.py", line 362, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/terminal/ipapp.py", line 307, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 474, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/config/application.py", line 405, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/utils/importstring.py", line 42, in import_item
    module = __import__(package, fromlist=[obj])
  File "/usr/local/lib/python2.7/dist-packages/ipython-1.1.0-py2.7.egg/IPython/html/notebookapp.py", line 38, in <module>
    from jinja2 import Environment, FileSystemLoader
ImportError: No module named jinja2

最佳答案

为了在本地加载Jinja,您还必须在本地安装它

easy_install Jinja2


要么

pip install Jinja2


要么

sudo apt-get install python-jinja2

关于python - 我无法让ipython笔记本正常工作。 Ubuntu 12.04 ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20619987/

10-11 07:45