iPython给我一个语法错误

时间:2013-04-25 22:59:40

标签: python linux ubuntu ipython

我正在运行python 2.4并已将iPython安装到我的ubuntu机器上。 我现在遇到的问题是,每当我尝试从终端启动它时,它一直给我一个ImportError。

现在,符号链接位于/usr/local/bin,实际文件位于/usr/bin/

错误讯息:

File "/usr/local/bin/ipython", line 9
except ImportError as e:
                    ^
SyntaxError: invalid syntax

iPython文件......

#!/opt/ttools/bin/python ## YES THIS IS THE CORRECT PATH
"""Terminal-based IPython entry point.
"""

from IPython.frontend.terminal.ipapp import launch_new_instance

try:
  launch_new_instance()
except ImportError as e:
  if "qt.console.qtconsoleapp" in e.message:
    print "Could not start qtconsole. Please install ipython-qtconsole"
  elif "html.notebook.notebookapp" in e.message:
    print "Could not start notebook. Please install ipython-notebook"
  else:
    # if there is no clue on the cause -- just re-raise
    raise

当我不得不将它设置在我的Mac上时,我从未遇到过这样的问题...

任何帮助将不胜感激。谢谢 !!

编辑::解决方案

下载http://archive.ipython.org/release/0.10.2/ipython-0.10.2-py2.6.egg

导航到downloads文件夹并运行以下命令:

sudo easy_install ipython-0.10.2-py2.6.egg

1 个答案:

答案 0 :(得分:2)

iPython放弃了对python的支持< 2.6从版本0.11开始,您必须从存档中安装0.10(或甚至可能是0.9):

http://archive.ipython.org/release/