Python subprocess.CalledProcessError:命令'adb devices'返回非零退出状态127

时间:2013-10-11 22:25:39

标签: python ubuntu-12.04 adb

我正在使用Ubuntu12.04,我看到下面的错误,在我看来,某种程度上python试图调用adb命令,但失败了。

/bin/sh: 1: adb: not found
Traceback (most recent call last):
 `File "./test.py", line 1395, in <module>
    main()
  File "./test.py", line 1218, in main
    Device.wait_for_device(TIMEOUT, None, a.getport())
  File "./test.py", line 433, in wait_for_device
    if (len(a) == 1 and get_attached_devices()):
  File "./test.py", line 126, in get_attached_devices
    lines = subprocess.check_output(adb_rel_path + 'adb devices', shell =True).split('\n')
  File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
   subprocess.CalledProcessError: Command 'adb devices' returned non-zero exit status 127

我按照instructinos安装pyadb: https://pypi.python.org/pypi/pyadb/0.1.1

但它仍然没有用。我现在不知道。 有谁知道我是否遗漏了任何包裹或程序?

2 个答案:

答案 0 :(得分:5)

退出代码127表示“未找到命令”,您确定可以从标准终端执行abd吗?

答案 1 :(得分:0)

我有同样的例外,而我确实尝试通过buidout安装两个版本的python。所以我必须安装build-essential,因此buildout可以执行make命令。

sudo apt-get install build-essential