python 报错error193,WindowsError:[错误193]%1不是在Python有效的Win32应用程序

I wish to import liblas module in Python 2.7 on window 64bit. If I import the module with IDLE (Python GUI) I have no problem.

If I use PyScripter "PyScripter-v2.5.3-x64-Setup.exe" I get this error message.

>>> import liblas

Traceback (most recent call last):

File "", line 1, in

File "C:\Python27\lib\site-packages\liblas\__init__.py", line 2, in

from core import get_version

File "C:\Python27\lib\site-packages\liblas\core.py", line 138, in

las = ctypes.CDLL(os.path.join(local_dlls, lib_name))

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

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

WindowsError: [Error 193] %1 is not a valid Win32 application

I have used liblas in PyScripter many times without problem and right now I can load all standard modules (e.g.: numpy, GDAL, etc.), but tonight (I need to finish an analysis!!!) I have this inconvenience.

解决方案

Please make sure to have Python 2.7 64b edition :) or even though you are working on 64b OS, use the x86 (AKA 32b) edition of PyScripter

Edit 1 (following comments exchange w/ Gianni)

One should verify his/her entire Python process "composed" from same entities in the sense of 32b/64b builds (e.g. if your Python interpreter is 32b one, then it must use C types coming from C dll Python extensions which were compiled as 32b dlls).

In our example (liblas) one should go to C:\Python27\lib\site-packages\liblas , find the extension dll and see its type via dumpbin , here is some picture for demonstration :

yKWpD.jpg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值