1

尝试在构建 Fuchsia 之前设置目标,但出现以下错误。我尝试sep通过使用将其转换为字节,b.startswith(b'sep')然后它给出了错误。所以我只是坚持如何处理这个问题。我对python的了解为零。

prashant@prashant-Lenovo:~/fuchsia$ scripts/fx set x64

输出是:

ERROR at //build/gn/BUILD.gn:67:5: Script returned non-zero exit code.
    exec_script("//build/zircon/list_source_files.py", [], "list lines")
    ^---------- Current dir: /home/prashant/fuchsia/out/x64/ Command: /usr/bin/env -- /home/prashant/fuchsia/build/zircon/list_source_files.py Returned 1. stderr:

Traceback (most recent call last):   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 36, in <module>
    sys.exit(main())   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 31, in main
    for file in get_files():   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 27, in get_files
    return [os.path.join(ZIRCON_ROOT, file) for file in files]   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 27, in <listcomp>
    return [os.path.join(ZIRCON_ROOT, file) for file in files]   File "/usr/lib/python3.6/posixpath.py", line 87, in join
    if b.startswith(sep): TypeError: startswith first arg must be bytes or a tuple of bytes, not str
4

1 回答 1

1

我也遇到了这个特殊问题。问题可能来自您的系统的python别名为python3而不是python2.

这是紫红色构建脚本中的一个错误。可以通过以下任一方式解决:

  • 将文件的 python 解释器从 from: 更新#!/usr/bin/env python#!/usr/bin/env python2
  • 将系统设置python为指向python2. 这可能会破坏您系统上的其他内容。
于 2019-04-17T02:54:24.720 回答