(python_caveat)=
LLDB has a powerful scripting interface which is accessible through Python. Python is available either from within LLDB through a (interactive) script interpreter, or as a Python module which you can import from the Python interpreter.
To make this possible, LLDB links against the Python shared library. Linking against Python comes with some constraints to be aware of.
pip) from the same Python distribution as the one used to build and link LLDB.The previous considerations are especially important during development, but apply to binary distributions of LLDB as well.
Users of lldb in Xcode on macOS commonly run into these issues when they install Python, often unknowingly as a dependency pulled in by Homebrew or other package managers. The problem is the symlinks that get created in /usr/local/bin, which comes before /usr/bin in your path. You can use which python3 to check to what it resolves.
To be sure you use the Python that matches with the lldb in Xcode use xcrun or use the absolute path to the shims in /usr/bin.
$ xcrun python3 $ /usr/bin/python3
Similarly, to install packages and be able to use them from within lldb, you'll need to install them with the matching pip3.
$ xcrun pip3 $ /usr/bin/pip3