IMPORTERROR: MEMORYLOADLIBRARY FAILED LOADING

在使用py2exe将程序生成exe的时候,py2exe提供了一个bundle参数,默认是3

3: don't bundle

2: bundle everything but the Python interpreter

1: bundle everything, including the Python interpreter

开始的时候,还以为bundle取值只是对最后的dist文件夹里的不同而已,而对于应用程序实际的没有任何区别,结果就是因为这个我花1天的时间调试。

复制代码
 1 setup(console=["mkiso.py"],
 2       options={
 3         "py2exe":{
 4             "dll_excludes":["MSVCP90.dll, MSVCR90.dll"],
 5             'packages':['lxml'],
 6             'bundle_files': 1,
 7             }
 8       },
 9       data_files = ds,
10 )
复制代码

最开始打包代码是这样的,结果总是报ImportError: MemoryLoadLibrary failed loading xapian\_xapian.pyd找了半天,都不知道问题在哪里。最后把bundle_files参数去掉,一切都没问题。

bundle_files设置成1的时候,最好把python引用的所有库都打包在library里,导致没法引用到xapian\_xapian.pyd,虽然library里确实存在,但是就是无法引用到。这里记录一下。

转自:http://www.cnblogs.com/twelfthing/articles/2771232.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
内存加载动态库 MemoryLoadLibrary 有例子。 /* * Memory DLL loading code * Version 0.0.3 * * Copyright (c) 2004-2013 by Joachim Bauch / mail@joachim-bauch.de * http://www.joachim-bauch.de * * The contents of this file are subject to the Mozilla Public License Version * 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is MemoryModule.h * * The Initial Developer of the Original Code is Joachim Bauch. * * Portions created by Joachim Bauch are Copyright (C) 2004-2013 * Joachim Bauch. All Rights Reserved. * */ #ifndef __MEMORY_MODULE_HEADER #define __MEMORY_MODULE_HEADER #include typedef void *HMEMORYMODULE; typedef void *HMEMORYRSRC; typedef void *HCUSTOMMODULE; #ifdef __cplusplus extern "C" { #endif typedef HCUSTOMMODULE (*CustomLoadLibraryFunc)(LPCSTR, void *); typedef FARPROC (*CustomGetProcAddressFunc)(HCUSTOMMODULE, LPCSTR, void *); typedef void (*CustomFreeLibraryFunc)(HCUSTOMMODULE, void *); /** * Load DLL from memory location. * * All dependencies are resolved using default LoadLibrary/GetProcAddress * calls through the Windows API. */ HMEMORYMODULE MemoryLoadLibrary(const void *); /** * Load DLL from memory location using custom dependency resolvers. * * Dependencies will be resolved using passed callback methods. */ HMEMORYMODULE MemoryLoadLibraryEx(const void *, CustomLoadLibraryFunc, CustomGetProcAddressFunc, CustomFreeLibraryFunc, void *); /** * Get address of exported method. */ FARPROC MemoryGetProcAddress(HMEMORYMODULE, LPCSTR); /** * Free previously loaded DLL. */ void MemoryFreeLibrary(HMEMORYMODULE); /** * Find the location of
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值