Code runs in PyCharm but not Jupyter

I has the similar issue.

Adding this line

    os.add_dll_directory(        r"c:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin" )

(path to g++ dlls) made the code work in jupyter.