随着最近的升级,我现在遇到一个严重的问题,SyntaxError: invalid syntax
当启动笔记本的python2.7实例时$ ipython2 notebook
.
该错误似乎源于tornado
使用ayncio
和在该库中有python3.4语法.
我可以开始$ ipython3 notebook
,但我正在使用的应用程序正在使用mayavi
我认为仍然只用于python2.
令人讨厌的错误消息是:
$ ipython2 notebook Traceback (most recent call last): File "/usr/local/bin/ipython2", line 11, insys.exit(start_ipython()) File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line 118, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 591, in launch_instance app.initialize(argv) File " ", line 2, in initialize File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 75, in catch_config_error return method(app, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize super(TerminalIPythonApp, self).initialize(argv) File " ", line 2, in initialize File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 75, in catch_config_error return method(app, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/IPython/core/application.py", line 386, in initialize self.parse_command_line(argv) File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File " ", line 2, in parse_command_line File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 75, in catch_config_error return method(app, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 487, in parse_command_line return self.initialize_subcommand(subc, subargv) File " ", line 2, in initialize_subcommand File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 75, in catch_config_error return method(app, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 418, in initialize_subcommand subapp = import_item(subapp) File "/usr/local/lib/python2.7/dist-packages/ipython_genutils/importstring.py", line 31, in import_item module = __import__(package, fromlist=[obj]) File "/usr/local/lib/python2.7/dist-packages/notebook/notebookapp.py", line 48, in from tornado import httpserver File "/usr/local/lib/python2.7/dist-packages/tornado/httpserver.py", line 34, in from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters File "/usr/local/lib/python2.7/dist-packages/tornado/http1connection.py", line 28, in from tornado import gen File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1236, in import tornado.platform.asyncio File "/usr/local/lib/python2.7/dist-packages/tornado/platform/asyncio.py", line 33, in import asyncio File "/usr/local/lib/python2.7/dist-packages/asyncio/__init__.py", line 9, in from . import selectors File "/usr/local/lib/python2.7/dist-packages/asyncio/selectors.py", line 39 "{!r}".format(fileobj)) from None ^ SyntaxError: invalid syntax
什么会对我的作品有所帮助?降级龙卷风?我的设置有问题吗?为什么在python2.7下安装asyncio是可能的呢?
降级龙卷风的工作原理:
$ sudo pip install tornado==4.1 $ ipython2 notebook [I 17:22:31.800 NotebookApp] Serving notebooks from local directory: /home/fnielsen/fnielsen/ipynb ...