sighingnow / libclang

(Unofficial) Release libclang (clang.cindex) on pypi.
https://pypi.org/project/libclang
Other
81 stars 21 forks source link

Doesn't seem to work #57

Open Yiannis128 opened 1 year ago

Yiannis128 commented 1 year ago

Hi, this seems to be a really useful package, however, it seems I can't get it to work. When I run the script below, I get the following error. PS: I have libclang.so in /usr/lib/libclang.so.

#!/usr/bin/env python

import os
from clang.cindex import Config

Config.library_path = os.path.join(
    os.path.dirname(os.path.realpath(__file__)), "native"
)

print("Hello world")
Traceback (most recent call last):
  File "/home/yiannis/git/esbmc-ai/./testclang.py", line 4, in <module>
    from clang.cindex import Config
ModuleNotFoundError: No module named 'clang.cindex'

For context, I installed the libclang Python package using pipenv. pipenv install libclang.

sighingnow commented 11 months ago

Do you have a directory called "clang" under your working directory?

Yiannis128 commented 11 months ago

Do you have a directory called "clang" under your working directory?

No, what should the contents of "clang" be?

sighingnow commented 11 months ago

Cannot see why "ModuleNotFoundError: No module named 'clang.cindex'" error. The possible reason is you have a directory called "clang" under your working directory so python cannot find the correct installation, or, you are working with a python interpreter or virtual env that different from the env where libclang is installed.