我想对窗口64位进口 liblas 模块在Python 2.7。如果我导入与IDLE(Python的GUI)模块我没有问题。
如果我用 PyScripter PyScripter-v2.5.3-64-的Setup.exe我收到此错误信息。
>>>进口liblas
回溯(最近通话最后一个):
文件<交互式输入>中,1号线,与<模块>
文件C: Python27 lib目录站点包 liblas __ init__.py,2号线,与<模块>
主营进口get_version
文件C: Python27 lib目录站点包 liblas core.py,线路138,与<模块>
拉斯= ctypes.CDLL(os.path.join(local_dlls,lib_name))
文件C: Python27 LIB ctypes的 __ init__.py,线路365,在__init__
self._handle = _dlopen(self._name,模式)
WindowsError:[错误193]%1不是有效的Win32应用程序
我已经使用liblas在PyScripter很多次没有问题,现在我可以装载所有标准模块(如:numpy的,GDAL等),但今晚(我需要完成的分析!)我有这种不便。
解决方案请确保有Python的2.7 64B版:)或者即使您正在使用64B操作系统,使用的x86 PyScripter
修改1(以下意见交换瓦特/詹尼)
每个人都应该检查他/她的全部的Python的过程中,从相同的实体组成的在32B / 64B的意义构建(例如,如果你的Python跨preTER是32B之一,那么它必须使用C型从C DLL Python扩展未来它被编译为32B的DLL)。
在我们的例子中(liblas)应该去 C: Python27 lib目录站点包 liblas
,找到扩展DLL,并通过看它的类型 DUMPBIN ,这里是一些图片演示:
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 "<interactive input>", line 1, in <module>
File "C:Python27libsite-packagesliblas__init__.py", line 2, in <module>
from core import get_version
File "C:Python27libsite-packagesliblascore.py", line 138, in <module>
las = ctypes.CDLL(os.path.join(local_dlls, lib_name))
File "C:Python27Libctypes__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:Python27libsite-packagesliblas
, find the extension dll and see its type via dumpbin , here is some picture for demonstration :
相关推荐
最新文章