I try to use clang in a python script. I do banal operations:

from clang.cindex import Config, Index path_to_lib = 'C://Python27//DLLs//libclang.dll' Config.set_library_path(path_to_lib) 

Further, the code and in another function continue to work with the liby:

 lib_clang_args = [] # Вот здесь падаю с ошибкой cindex = Index.create() 

LibclangError: [Error 126] The specified module couldn't be found. To provide a path to libclang use Config.set_library_path () or Config.set_library_file ().

Python's digits, systems and clang are the same, 32 bits. The path to it as soon as I did not register it did not help. Tell me why the python does not see the lib and how to fix it?

PS: maybe something is wrong with the version? Already threw all the files that need to be in directories inside the C: // Python27 folder , namely:

C: //Python27//Lib//cindex.py
C: //Python27//Lib//cindex.pyc
C: //Python27//Lib//enumerations.py
C: //Python27//Lib//enumerations.pyc
C: //Python27//libs//libclang.lib
C: //Python27//DLLs//libclang.dll

Here is another tutorial, but it did not help me to solve the problem. Maybe someone will be useful: Parsing C ++ in Python with Clang

  • os.path.exists (path_to_lib) check, suddenly sealed up somewhere - FeroxTL
  • @FeroxTL, "True" was output to the console, which means the path is correct. - neo

0