Why running lldb with HomeBrew Python 2 installed produces ImportError and NameErrors?

I installed six module with pip python package manager and it solves the problem:

$ pip install six
Collecting six
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.10.0

$ lldb myExecutableFile
(lldb) target create "myExecutableFile"
Current executable set to 'myExecutableFile' (x86_64).
(lldb)

The Apple lldb (from /usr/bin/lldb) expects and requires /usr/bin/python. Unfortunately, it doesn't use this absolute path to invoke it, but just python.

Thus, with a Python 2 also installed by Homebrew inside /usr/local/bin which is in the front of your PATH the Apple lldb gets an unexpected Python 2 which may introduce errors like missing expected packages or worse.

The safe thing is thus to call lldb with a different PATH:

$ PATH=/usr/bin:$PATH lldb ...

Or even configure an alias or wrapper script, e.g.:

$ alias lldb='PATH=/usr/bin:$PATH lldb'