ImportError:DLL加载失败(PyCrypto-2.6.1)

时间:2016-06-23 13:29:21

标签: python

我正在使用PyInstaller使用以下命令将包含模块的python文件转换为一个可执行文件: pyinstaller --onedir --onefile --name=IFSCP "C:\Python27\main.py" 我没有使用前缀 - 窗口,因为Python程序处于控制台模式。

编译时一切都很顺利,但打开可执行文件时有一个问题。加载可执行文件会出现以下错误:

Traceback (most recent call last):
 File "main.py", line 13 in <module>
 File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
     exec(bytecode, module, __dict__)
 File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\AES.py", line 50, in <module>
 File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
     exec(bytecode, module, __dict__)
 File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 7 in <module>
 File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 6 in __bootstrap__

ImportError:DLL加载失败:Kan opgegeven模块niet vinden。

Kan opgegeven模块niet vinden。 - &GT;找不到模块

如果没有,则不会显示ImportError from Crypto.Cipher import AES 在脚本中。

调试信息:

C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\IFSCP\dist>IFSCP.exe

PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5
d\IFSCP\dist\IFSCP.exe
LOADER: homepath is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\
IFSCP\dist
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a
5d\IFSCP\dist\IFSCP.exe
LOADER: Extracting binaries
LOADER: Executing self as child
LOADER: set _MEIPASS2 to C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
LOADER: Setting up to run child
LOADER: Creating child process
LOADER: Waiting for child process to finish...
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5
d\IFSCP\dist\IFSCP.exe
LOADER: homepath is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\
IFSCP\dist
LOADER: _MEIPASS2 is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
LOADER: archivename is C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a
5d\IFSCP\dist\IFSCP.exe
LOADER: SetDllDirectory(C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522)
LOADER: Already in the child - running user's code.
LOADER: manifestpath: C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522\IFSCP.exe.m
anifest
LOADER: Activation context created
LOADER: Activation context activated
LOADER: Python library: C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522\python27.
dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: sys.prefix is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60~1
LOADER: Setting runtime options
LOADER: Bootloader option: pyi-windows-manifest-filename IFSCP.exe.manifest
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\YOURIK~1\AppData\Local\Temp\_MEI60522
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running pyi_rth_pkgres.py
LOADER: Running pyi_rth__tkinter.py
LOADER: Running main.py
Traceback (most recent call last):
  File "main.py", line 13, in <module>
  File "C:\Users\Youri Kool\Desktop\pyinstaller-pyinstaller-8689a5d\PyInstaller\
loader\pyimod03_importers.py", line 389, in load_module
    exec(bytecode, module.__dict__)
  File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-
py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 7, in <module>
  File "c:\users\yourik~1\appdata\local\temp\easy_install-gzievh\pycrypto-2.6.1-
py2.7-win32.egg.tmp\Crypto\Cipher\_AES.py", line 6, in __bootstrap__
ImportError: DLL load failed: Kan opgegeven module niet vinden.
Failed to execute script main
LOADER: OK.
LOADER: Cleaning up Python interpreter.
LOADER: Back to parent (RC: -1)
LOADER: Doing cleanup
LOADER: Freeing archive status for C:\Users\Youri Kool\Desktop\pyinstaller-pyins
taller-8689a5d\IFSCP\dist\IFSCP.exe

我安装了以下应用程序:

  • Pywin32版本220
  • cx-Freeze version 4.3.4
  • PyCrypto版本2.6.1

Pyinstaller pyinstaller-pyinstaller-8689a5d(Developer)和PyInstaller-3.2给出了同样的错误。

1 个答案:

答案 0 :(得分:-1)

我将import Crypto替换为something = Crypto.Cipher.AES.new(...) 。然后在代码中:

SELECT ut.table_name, sum(s.bytes)/1024 as"SizeinKB" 
FROM user_tables ut
  JOIN user_segments s ON ut.table_name = s.segment_name
group by ut.table_name
ORDER BY ut.table_name;

我的.exe运行良好