2016-07-15 185 views
4
C:\Users\Shalia\Desktop\accuadmin>python setup_py2exe.py py2exe 
running py2exe 

    10 missing Modules 
    ------------------ 
? PIL._imagingagg      imported from PIL.ImageDraw 
? PyQt4        imported from PIL.ImageQt 
? PyQt5        imported from PIL.ImageQt 
? PySide        imported from PIL.ImageQt 
? _imaging_gif      imported from PIL.GifImagePlugin 
? _util        imported from PIL.ImageCms 
? cffi        imported from PIL.Image, PIL.PyAccess 
? enchant        imported from guess_language 
? readline       imported from cmd, code, pdb 
? tkinter        imported from PIL.ImageTk, __SCRIPT__ 
Building 'dist\AccuAdmin.exe'. 
error: [Errno 2] No such file or directory: 'C:\\Users\\Shalia\\AppData\\Local\\ 
Programs\\Python\\Python35-32\\lib\\site-packages\\py2exe\\run-py3.5-win32.exe' 

於是,我就聰明,去了這條道路,並更名爲運行py3.4-win32.exe到運行py3.4-win32.exe哪些工作除了沒有我得到一個單獨的錯誤。Py2exe錯誤:[錯誤2]沒有這樣的文件或目錄

C:\Users\Shalia\Desktop\accuadmin>python setup_py2exe.py py2exe 
running py2exe 

    10 missing Modules 
    ------------------ 
? PIL._imagingagg      imported from PIL.ImageDraw 
? PyQt4        imported from PIL.ImageQt 
? PyQt5        imported from PIL.ImageQt 
? PySide        imported from PIL.ImageQt 
? _imaging_gif      imported from PIL.GifImagePlugin 
? _util        imported from PIL.ImageCms 
? cffi        imported from PIL.Image, PIL.PyAccess 
? enchant        imported from guess_language 
? readline       imported from cmd, code, pdb 
? tkinter        imported from PIL.ImageTk, __SCRIPT__ 
Building 'dist\AccuAdmin.exe'. 
Building shared code archive 'dist\library.zip'. 
Traceback (most recent call last): 
    File "setup_py2exe.py", line 14, in <module> 
    "optimize": 2, 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\distutils\ 
core.py", line 148, in setup 
    dist.run_commands() 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\distutils\ 
dist.py", line 955, in run_commands 
    self.run_command(cmd) 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\distutils\ 
dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa 
ges\py2exe\distutils_buildexe.py", line 188, in run 
    self._run() 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa 
ges\py2exe\distutils_buildexe.py", line 268, in _run 
    builder.build() 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa 
ges\py2exe\runtime.py", line 261, in build 
    self.build_archive(libpath, delete_existing_resources=True) 
    File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa 
ges\py2exe\runtime.py", line 426, in build_archive 
    assert mod.__file__.endswith(EXTENSION_SUFFIXES[0]) 
AssertionError 

任何人都可以建議如何解決這個問題嗎? Py2exe應該適用於所有版本的Python,所以我不確定發生了什麼問題。我真的不想爲Python3.4卸載Python3.5。謝謝。

回答

2

一種方法是使用Python 3.4。 另一種解決方案是轉到您的Python目錄,在我的情況下,C:\Program Files\Python35,然後轉到Lib目錄,然後轉到site-packages目錄(如果您安裝了Py2Exe和pip)。然後,將run-py3.4-win32.exe文件複製到另一個目錄。將該文件重命名爲run-py3.5-win32.exe。將其複製回py2exe目錄。與run_ctypes_dll-py3.4-win32.dll一樣,但將其重命名爲run_ctypes_dll-py3.5-win32。它應該適用於大多數程序。

如果不起作用,安裝python 3.4,並通過鍵入py -3.4 setup_py2exe.py py2exe

+0

同樣的錯誤了OP我運行安裝腳本,試圖兩項建議。第一個沒有工作,第二個生成一個'exe',但仍然抱怨。 – Apollys

+0

嘗試卸載並重新安裝py2exe或其他任何東西 – Stiffy2000

+0

另外,在py 3.4中安裝所有缺少的模塊。 – Stiffy2000

相關問題