Python Forum
Resolving ImportError: No module named gdb (Python in C++)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Resolving ImportError: No module named gdb (Python in C++)
#1
The following serves as the foundation of my code; however, I encounter an error: "ImportError: No module named gdb". How can I resolve this issue? Google Bard AI has suggested using the command pip install gdb in the terminal, but I would like the GDB Python API to be installed permanently within my project. I want it to reside in the project's third-party or binary folder, similar to how the python312.dll can be placed in the binary folder. This way, it remains unaffected even if I reinstall the operating system. I'm building a game engine, and I want to make it easy for users to get started without requiring them to install the GDB Python API. I want to replicate the experience of using VSCode, where users can install GCC without needing to install GDB Python API.

Python version: 3.12.0

// https://stackoverflow.com/questions/17028576/using-python-3-3-in-c-python33-d-lib-not-found
#ifdef _DEBUG
    #undef _DEBUG
    #include <Python.h>
    #define _DEBUG
#else
    #include <Python.h>
#endif

int main() {
    Py_Initialize();

    PyRun_SimpleString(std::string(R"_(
import gdb # ImportError: No module named gdb
print("Hello, World!")
    )_").substr(1).c_str());

    Py_Finalize();
    return 0;
}
Reply


Messages In This Thread
Resolving ImportError: No module named gdb (Python in C++) - by mandaxyz - Oct-04-2023, 10:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 982 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync' stsxbel 2 24,086 Nov-02-2023, 08:20 AM
Last Post: South_east
  ModuleNotFoundError: No module named 'requests' Serg 18 2,759 Oct-29-2023, 11:33 PM
Last Post: Serg
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,608 Aug-07-2023, 05:32 AM
Last Post: DPaul
  ModuleNotFoundError: No module named 'eyed3' Wimpy_Wellington 2 1,396 Jul-10-2023, 03:37 AM
Last Post: Wimpy_Wellington
  How to fix this error: ModuleNotFoundError: No module named 'notears' yaoyao22 2 1,073 Jul-09-2023, 11:24 AM
Last Post: yaoyao22
  Help with pyinstaller "No module named" korenron 9 9,428 Jun-15-2023, 12:20 PM
Last Post: snippsat
  Problem with Pyinstaller. No module named '_tkinter' tonynapoli2309 0 1,053 May-15-2023, 02:38 PM
Last Post: tonynapoli2309
  ModuleNotFoundError: No module named 'omsdk.sdkproto' donvito7 4 1,910 Oct-20-2022, 02:56 PM
Last Post: deanhystad
  ModuleNotFoundError: No module named '_struct' when starting pip3 yuhuihu 0 2,914 May-05-2022, 04:41 AM
Last Post: yuhuihu

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020