Python环境搭建问题求助,Libclang相关,pythonlibclang,我已经将C:\Progr
Python环境搭建问题求助,Libclang相关,pythonlibclang,我已经将C:\Progr
我已经将C:\Program Files (x86)\LLVM\bin加入到环境变量里的path里了
在代码中也用
clang.cindex.Config.set_library_file('C:\Program Files (x86)\LLVM\bin\libclang.dll')
指明了libclang.dll的位置
测试用的test.py整个文件是
import sysimport clang.cindexdef find_typerefs(node, typename): """ Find all references to the type named 'typename' """ if node.kind.is_reference(): ref_node = clang.cindex.Cursor_ref(node) if ref_node.spelling == typename: print 'Found %s [line=%s, col=%s]' % ( typename, node.location.line, node.location.column) # Recurse for children of this node for c in node.get_children(): find_typerefs(c, typename)clang.cindex.Config.set_library_file('C:\Program Files (x86)\LLVM\bin\libclang.dll')index = clang.cindex.Index.create()tu = index.parse(sys.argv[1])print 'Translation unit:', tu.spellingfind_typerefs(tu.cursor, sys.argv[2])
但是运行是仍提示找不到libclang
错误信息为
Traceback (most recent call last):
File "C:\Users\willzhang\Desktop\test_clang\test.py", line 16, in
index = clang.cindex.Index.create()
File "C:\Users\willzhang\Desktop\test_clang\clang\cindex.py", line 2047, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
File "C:\Users\willzhang\Desktop\test_clang\clang\cindex.py", line 141, in get
value = self.wrapped(instance)
File "C:\Users\willzhang\Desktop\test_clang\clang\cindex.py", line 3357, in lib
lib = self.get_cindex_library()
File "C:\Users\willzhang\Desktop\test_clang\clang\cindex.py", line 3388, in get_cindex_library
raise LibclangError(msg)
LibclangError: [Error 126] . To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
请问这是怎么回事^_^
编橙之家文章,
相关内容
- python哪个库支持提取文本部分内容,,目前只找到了几个
- Ruby Mechanize发送post请求不成功,高手帮忙看下,rubymech
- 哪里有好的null object pattern应用实例,pattern应用实例,
- pyqt点击按钮无响应如何调整,pyqt点击按钮响应,如图:
- 配置好的python编译环境,却找不到sublime类是为什么?,
- Python django AutoField从2开始的前提条件蛤是什么,django
- python伪静态异常跳转后就失败,python伪静态跳转,<I
- 请问我的python AVL树这样号写对不对,,class Node(o
- Debian Python程序,用mplayer能实现渐变效果吗?,pythonmplay
- 有经验的Python大师帮看看CRC16代码实现过程错误在哪里
评论关闭