简体   繁体   English

无法解决OSError:[WinError 193]%1不是有效的Win32应用程序

[英]Unable to resolve OSError: [WinError 193] %1 is not a valid Win32 application

I tried to run the python code on command line .I facing error OSError: [WinError 193] %1 is not a valid Win32 application . 我试图在命令行上运行python代码。我OSError: [WinError 193] %1 is not a valid Win32 application错误OSError: [WinError 193] %1 is not a valid Win32 application

I am new to python clang wrapper functions. 我是python clang包装函数的新手。 I am using python 3.7.2 of 32 bit. 我正在使用32位的python 3.7.2。 I am using llvm of 64 bit of version 7.1.0. 我正在使用版本7.1.0的64位llvm。

    #!/usr/bin/env python   
    import sys
    import clang.cindex
    import ctypes
    clang.cindex.Config.set_library_path('C:/Program Files/LLVM/bin')



    print("argument1   ------> ",sys.argv[1])
    print("argument2   ------> ",sys.argv[2])


    def find_typerefs(node, typename):

        if node.kind.is_reference():
            ref_node = node.get_definition()
            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)




    index = clang.cindex.Index.create()




    tu = index.parse(sys.argv[1])
    print( 'Translation unit:', tu.spelling)
    find_typerefs(tu.cursor, sys.argv[2])

I tried with subprocess.call([sys.executable, 'parser.py', 'dummyC++.cpp','person'],shell=True) and getting same error 我尝试了subprocess.call([sys.executable,'parser.py','dummyC ++。cpp','person'],shell = True)并得到相同的错误

  File "C:\Python37-32\lib\site-packages\clang\cindex.py", line 4129, in get_cindex_library
    library = cdll.LoadLibrary(self.get_filename())
  File "C:\Python37-32\lib\ctypes\__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python37-32\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "parser.py", line 30, in <module>
    index = clang.cindex.Index.create()
  File "C:\Python37-32\lib\site-packages\clang\cindex.py", line 2666, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "C:\Python37-32\lib\site-packages\clang\cindex.py", line 198, in __get__
    value = self.wrapped(instance)
  File "C:\Python37-32\lib\site-packages\clang\cindex.py", line 4103, in lib
    lib = self.get_cindex_library()
  File "C:\Python37-32\lib\site-packages\clang\cindex.py", line 4134, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: [WinError 193] %1 is not a valid Win32 application. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().

This is the error message 这是错误消息

Install 32 bit version of llvm from this( http://releases.llvm.org/download.html ) make sure 32 bit version of python is installed. 从此( http://releases.llvm.org/download.html )安装32位版本的llvm,确保已安装32位版本的python。 and everything works fine. 一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OSError: [WinError 193] %1 不是 Python 中的有效 Win32 应用程序 - OSError: [WinError 193] %1 is not a valid Win32 application in python OSError: [WinError 193] %1 不是有效的 Win32 应用程序 - OSError: [WinError 193] %1 is not a valid Win32 application OSError: [WinError 193] %1 不是有效的 Win32 应用程序 (Pandas) - OSError: [WinError 193] %1 is not a valid Win32 application (Pandas) OSError: [WinError 193] %1 不是有效的 Win32 应用程序 - python - OSError: [WinError 193] %1 is not a valid Win32 application - python OSError: [WinError 193] %1 不是有效的 Win32 应用程序 Python - OSError: [WinError 193] %1 is not a valid Win32 application Python OSError: [WinError 193] %1 不是 CTypes 中的有效 Win32 应用程序 - OSError: [WinError 193] %1 is not a valid Win32 application in CTypes OSError: [WinError 193] %1 不是有效的 Win32 应用程序 - nltk - OSError: [WinError 193] %1 is not a valid Win32 application - nltk OSError: [WinError 193] %1 不是有效的 Win32 应用程序 (LibTiff) - OSError: [WinError 193] %1 is not a valid Win32 application (LibTiff) 如何修复“OSError: [WinError 193] %1 不是有效的 Win32 应用程序” - How to fix"OSError: [WinError 193] %1 is not a valid Win32 application" Azure - numpy - OSError:[WinError 193]%1不是有效的Win32应用程序 - Azure - numpy - OSError: [WinError 193] %1 is not a valid Win32 application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM