2016-12-31 378 views
0

我一直在嘗試使用pyinstaller將一個.py文件轉換爲.exe文件(失敗,太多模塊丟失)已經轉移到cx_freeze,事情運行更順暢,但我仍然無法編譯我的腳本。 我使用Windows 10,64位,如果它很重要。 這裏是我的setup.py導入錯誤:DLL加載失敗:使用cxfreeze時找不到指定的模塊

import sys 
from cx_Freeze import setup, Executable 

setup(
    name = "EyeBreak", 
    version = "3.1", 
    description = "Script to remind user of 202020 eye rule.", 
    executables = [Executable("EyeBreak.py", base = "Win32")]) 

我從CMD得到一個錯誤如下:

Microsoft Windows [Version 10.0.14393] 
(c) 2016 Microsoft Corporation. All rights reserved. 

C:\Users\fares>cd c:\Python34 

c:\Python34>python setup.py build 
running build 
running build_exe 
Traceback (most recent call last): 
    File "setup.py", line 8, in <module> 
    executables = [Executable("EyeBreak.py", base = "Win32")]) 
    File "c:\Python34\lib\site-packages\cx_Freeze\dist.py", line 362, in setup 
    distutils.core.setup(**attrs) 
    File "c:\Python34\lib\distutils\core.py", line 148, in setup 
    dist.run_commands() 
    File "c:\Python34\lib\distutils\dist.py", line 955, in run_commands 
    self.run_command(cmd) 
    File "c:\Python34\lib\distutils\dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "c:\Python34\lib\distutils\command\build.py", line 126, in run 
    self.run_command(cmd_name) 
    File "c:\Python34\lib\distutils\cmd.py", line 313, in run_command 
    self.distribution.run_command(command) 
    File "c:\Python34\lib\distutils\dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "c:\Python34\lib\site-packages\cx_Freeze\dist.py", line 231, in run 
    metadata = metadata) 
    File "c:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 101, in __init__ 
    for n in self._GetDefaultBinPathExcludes() + binPathExcludes] 
    File "c:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 242, in _GetDefaultBinPathExcludes 
    **import cx_Freeze.util 
ImportError: DLL load failed: The specified module could not be found.** 

回答

0

檢查cx_Freeze安裝了util.pyd。從上面提到的錯誤,應該在以下位置:

C:\ Python34 \ LIB \站點包\ cx_Freeze \ util.pyd

如果沒有找到,安裝壞了。您可以使用此命令來安裝預構建的cx_Freeze:

python -m pip install cx_Freeze --upgrade 
相關問題