pythoninterpreter无法加载_无法加载c ++ DLL在python中

I am trying to use a C++ .dll in Python, but I can't even load it. I am trying the following python code to load it:

from ctypes import cdll

mydll = cdll.LoadLibrary('SORT_DLL.dll')

But when I try to run this I get:

D:\...\src\SORT_DLL\Debug>UseDll.py

Traceback (most recent call last):

File "D:\...\src\SORT_DLL\Debug\UseDll.py", line 2, in

mydll = cdll.LoadLibrary('SORT_DLL.dll')

File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary

return self._dlltype(name)

File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__

self._handle = _dlopen(self._name, mode)

WindowsError: [Error 193] %1 ist keine zulõssige Win32-Anwendung

The last sentence means "%1 is not a valid Win32 application" in English.

I already looked it up at http://docs.python.org/2/library/ctypes.html#module-ctypes , but this didn't lead to a solution for my problem.

解决方案

Sounds like you have an incompatible version of Python installed or the DLL was compiled using the wrong settings. The DLL and the Python interpreter both have to be either 32 or 64 Bit.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值