Py2exe错误:[Errno 2]没有这样的文件或目录

时间:2016-07-15 16:03:28

标签: python pip py2exe

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'

所以我试着变得聪明并且去了那条路径并将run-py3.4-win32.exe重命名为run-py3.4-win32.exe,除了没有我收到单独的错误之外。

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。感谢。

1 个答案:

答案 0 :(得分:3)

一种方法是使用Python 3.4。 另一个解决方案是转到你的Python目录,在我的例子中,C:\Program Files\Python35,然后转到Lib目录,然后转到site-packages目录(如果你安装了Py2Exe {{1} }})。然后,将pip文件复制到另一个目录。将文件重命名为run-py3.4-win32.exe。将其复制回run-py3.5-win32.exe目录。对py2exe执行相同操作,但将其重命名为run_ctypes_dll-py3.4-win32.dll。它适用于大多数程序。

如果这不起作用,请安装python 3.4,然后输入run_ctypes_dll-py3.5-win32

运行设置脚本