不能在 lldb 中 运行 python 脚本

Can't run python scripts in lldb

我正在尝试 运行 lldb 中的一些 python。当我执行脚本命令时,出现以下错误:

(lldb) script
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named lldb.embedded_interpreter
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined

我在 Fedora 26 上使用 lldb 版本 4.0.1 和 Python 版本 2.7.13

您需要安装 python-lldb 才能运行。 sudo dnf install python-lldb 应该这样做。

您需要安装 python-lldb。不幸的是,yum 无法搜索当前未在机器上配置的存储库。即使包含所需模块的存储库已经在机器上配置,要在“yum list available”生成的可用模块列表中找到该模块并不总是那么容易。因此,要查找如何为您的 Linux distro/version 安装 python-lldb,请在线搜索关键字:在线搜索 yum 存储库。从搜索结果来看,select 一个在线包裹搜索网站(我使用了 https://pkgs.org)。搜索“python-lldb”和 select distro/version 的包信息页面(在我的例子中是 CentOS 7)。如有必要,使用存储库名称添加存储库(在我的例子中,存储库“CentOS SCLo RH x86_64 Official”已经存在)。将包名称与您正在使用的任何包管理器(在我的例子中是 yum)一起使用来安装。对我来说,我最终使用的命令是“sudo yum install -y llvm-toolset-7-python-lldb”。