简体   繁体   中英

How to install python packages to embedded python in GDB/ clion2017.1

I'm using CLion 2017.1 and GDB for debugging. GDB compiled with python 2.7 support, but with no modules.

I wish to use matplotlib in order to plot some debug data (using GDB image watch ) but there is no matplotlib presence. and no pip to install it.

I've tried to install pip using (gdb) python import get_pip but

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/temp/get_pip.py", line 28, in     <module>
    import tempfile
  File "/home/user/clion-2016.3.4/bin/gdb/lib/python2.7/tempfile.py", line 35, in <module>
    from random import Random as _Random
  File "/home/user/clion-2016.3.4/bin/gdb/lib/python2.7/random.py", line 48, in <module>
    from binascii import hexlify as _hexlify
ImportError: No module named binascii
Error while executing Python code.

So I don't know how to bootstrap instullation of additional modules into GDB's embedded python.

Any idea how to do that?

I've tried to install pip using (gdb) python import get_pip but

You need not install python modules from gdb shell. You can install them from command line as usual with your package manager or with pip. Make sure that you installed Python2 version of module. Once the module is installed you can use it in gdb embedded python:

$ gdb -q
(gdb) python
>import matplotlib
>end
(gdb) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM