repo init returns WindowsError: [Error 2]

repo init returns WindowsError: [Error 2]

环境:

  1. Windows 7
  2. Python 2.7(64 位)

当我运行 repo init -u https://android.googlesource.com/platform/manifest时,会产生以下错误:

Traceback (most recent call last):

  File "F:\android source code\.repo\repo/main.py", line 538, in <module>
    _Main(sys.argv[1:])

  File "F:\android source code\.repo\repo/main.py", line 512, in _Main
    result = repo._Run(argv) or 0

  File "F:\android source code\.repo\repo/main.py", line 181, in _Run
    portable.NoPager(cmd)

  File "F:\android source code\.repo\repo\portable.py", line 277, in NoPager
    RunWindowsShell(cmd)

  File "F:\android source code\.repo\repo\portable.py", line 281, in RunWindowsS
hell
    redirect_all(executable)

  File "F:\android source code\.repo\repo\portable.py", line 288, in redirect_al
l
    p = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=old_sysout,
 stderr=old_syserr)

  File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)

  File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)

WindowsError: [Error 2]

Windows错误2表示找不到文件。验证每个寻址文件是否确实存在于预期位置并且访问权限是否适当。最终你必须 运行 你的脚本具有管理员权限。