Skip to content

Instantly share code, notes, and snippets.

@tyhoff
Last active February 2, 2021 04:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyhoff/7a286945ef75947ad49a347dbc8708ca to your computer and use it in GitHub Desktop.
Save tyhoff/7a286945ef75947ad49a347dbc8708ca to your computer and use it in GitHub Desktop.
.lldbinit modifications for using a Virtual/Conda environment with LLDB Python scripts
# Source the python path fix
command script import ~/lldbinit.py
# Update LLDB's Python paths with the `sys.path` values of the local Python installation,
# whether that is brew'ed Python, a virtualenv, or another system python.
import os,subprocess,sys
# Execute a Python using the user's shell and pull out the sys.path (for site-packages)
paths = subprocess.check_output('python -c "import os,sys;print(os.linesep.join(sys.path).strip())"',shell=True).decode("utf-8").split()
# Extend LLDB's Python's search path
sys.path.extend(paths)
@tyhoff
Copy link
Author

tyhoff commented Apr 13, 2020

This was created for users to get around the "Caveat #3" for Python mentioned in LLDB's documentation.

https://lldb.llvm.org/resources/caveats.html#id1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment