python的terminator提示_解决无法运行Terminator出现以下问题: File "/usr/bin/terminator"...SyntaxError: invalid syntax...

在安装或者启动Terminator时可能出现这个问题:

lin@Dev:~$ terminator

File "/usr/bin/terminator", line 123

except (KeyError,ValueError), ex:

^

SyntaxError: invalid syntax

错误原因:语法错误.这是因为Terminator的安装或者运行需要python2的环境,但是却用python3的环境去运行Terminator了.

我们查看Terminator的启动脚本文件,在'/usr/bin'下.

vi /usr/bin/terminator

#!/usr/bin/python

# Terminator - multiple gnome terminals in one window

# Copyright (C) 2006-2010 cmsj@tenshu.net

#

# This program is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation, version 2 only.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with this program; if not, write to the Free Software

# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301

# USA

"""Terminator by Chris Jones """

import sys

import os

import psutil

....

....

第一行标示使用的是系统默认的python脚本.

系统安装的python的版本有两个分别是python2.7和python3.6,当python链接到python2.7时,程序运行正常,链接到python3.6时出现以上的语法错误。

解决方法:

1. 将系统默认的python版本链接到2(不建议)

2.  修改terminator的启动脚本(/usr/bin/terminator)如下:

#! /usr/bin/python2

保存退出重新运营terminator,成功.

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值