Py2exe error: [Errno 2] No such file or directory

2024/9/20 9:40:44
C:\Users\Shalia\Desktop\accuadmin>python setup_py2exe.py py2exe
running py2exe10 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'

So I tried to be clever and went to that path and renamed run-py3.4-win32.exe to run-py3.4-win32.exe which worked except not I'm getting a separate error.

C:\Users\Shalia\Desktop\accuadmin>python setup_py2exe.py py2exe
running py2exe10 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 setupdist.run_commands()File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\distutils\
dist.py", line 955, in run_commandsself.run_command(cmd)File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\distutils\
dist.py", line 974, in run_commandcmd_obj.run()File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 188, in runself._run()File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 268, in _runbuilder.build()File "C:\Users\Shalia\AppData\Local\Programs\Python\Python35-32\lib\site-packa
ges\py2exe\runtime.py", line 261, in buildself.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_archiveassert mod.__file__.endswith(EXTENSION_SUFFIXES[0])
AssertionError

Can anyone advise how to fix this? Py2exe should work for all versions of Python, so I'm not sure what's going wrong. I really don't want to have to uninstall Python3.5 for Python3.4. Thanks.

Answer

One method is to use Python 3.4. Another solution is to go to your Python Directory, in my case, C:\Program Files\Python35, then go to the Lib directory, then go to the site-packages directory (if you installed Py2Exe with pip). Then, copy the run-py3.4-win32.exe file to another directory. Rename the file to run-py3.5-win32.exe. Copy that back to the py2exe directory. Do the same with the run_ctypes_dll-py3.4-win32.dll, but rename it to run_ctypes_dll-py3.5-win32. It should work for most programs.

If that doesn't work, install python 3.4, and run your setup script by typing py -3.4 setup_py2exe.py py2exe

https://en.xdnf.cn/q/72360.html

Related Q&A

pandas rolling window mean in the future

I would like to use the pandas.DataFrame.rolling method on a data frame with datetime to aggregate future values. It looks it can be done only in the past, is it correct?

When should I use type checking (if ever) in Python?

Im starting to learn Python and as a primarily Java developer the biggest issue I am having is understanding when and when not to use type checking. Most people seem to be saying that Python code shoul…

Kartograph python script generates SVG with incorrect lat/long coords

I have modified this question to reflect some progress on discovering the problem. I am using the following python code to generate an SVG of the continental USA. The shapefile is irrelevant, as the …

Python multiprocessing blocks indefinately in waiter.acquire()

Can someone explain why this code blocks and cannot complete?Ive followed a couple of examples for multiprocessing and Ive writting some very similar code that does not get blocked. But, obviously, I…

What is the best way to control Twisteds reactor so that it is nonblocking?

Instead of running reactor.run(), Id like to call something else (I dunno, like reactor.runOnce() or something) occasionally while maintaining my own main loop. Is there a best-practice for this with …

Accessing the content of a variable array with ctypes

I use ctypes to access a file reading C function in python. As the read data is huge and unknown in size I use **float in C . int read_file(const char *file,int *n_,int *m_,float **data_) {...}The func…

What is the stack in Python?

What do we call "stack" in Python? Is it the C stack of CPython? I read that Python stackframes are allocated in a heap. But I thought the goal of a stack was... to stack stackframes. What …

Pandas: Resample dataframe column, get discrete feature that corresponds to max value

Sample data:import pandas as pd import numpy as np import datetimedata = {value: [1,2,4,3], names: [joe, bob, joe, bob]} start, end = datetime.datetime(2015, 1, 1), datetime.datetime(2015, 1, 4) test =…

How to filter string in multiple conditions python pandas

I have following dataframeimport pandas as pd data=[5Star,FiveStar,five star,fiv estar] data = pd.DataFrame(data,columns=["columnName"])When I try to filter with one condition it works fine.d…

Is there a way to use a dataclass, with fields with defaults, with __slots__

I would like to put __slots__ on a dataclass with fields with defaults. When I try do that, I get this error: >>> @dataclass ... class C: ... __slots__ = (x, y, ) ... x: int ... y:…