如何更改python命令以再次使用python2 [英] How to change python command to use python2 again

查看:181
本文介绍了如何更改python命令以再次使用python2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行脚本,但出现逗号错误:

I'm running a script and I get a comma error:

 dbconfigure -a abc -d ...

Traceback (most recent call last):
  File "/usr/local/bin/dbconf", line 6, in <module>
    from dbconf import main
  File "/usr/local/lib/python3.7/site-packages/dbconf/__init__.py", line 308
    except SDBResponseError, exc:
                           ^
SyntaxError: invalid syntax

所以我认为脚本使用python命令,但是我计算机上的python命令指向python3版本.我该如何解决?

So I think the script uses a python command but the python command on my computer points to a python3 version. How do I fix this?

推荐答案

您可以将

You can put the shebang header on Unix (including mac os). First line of your script should be #! /usr/bin/env python2

这篇关于如何更改python命令以再次使用python2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆