I am building my python app using PyInstaller. Python 3.11 PyInstaller 6.13.0 Windows 11 Desired behavior This is the structure I want to achieve after I build my app with PyInstaller: dist/ └── MyApp/ ├── MyApp.exe └── lib/ (this is normally the "_internal" folder, but renamed to "lib") Hence, I simply want to rename the "_internal" folder so that the bundled python knows the folder was renamed. Observed behavior I run $ pyinstaller --name MyApp MyApp.py and I keep getting this: dist/ └── MyApp/ ├── MyApp.exe └── _internal/ Clarification Let me be clear, I cannot simply rename my folder after building using PyInstaller as the .exe expects all the files in the "_internal" folder. If "_internal" folder is not there or is renamed, it still looks for it and raises an exception. Solutions tried I have tried to follow this Stackoverflow solution but it produces a different structure as follows: dist/ └── MyApp/ └── _internal/ ├── ... ├── MyApp.exe └── ... I have also tried changing the name parameter in my .spec file: exe = EXE( ..., name='lib', ... ) And coll = COLLECT( ..., name='lib', ... ) But this creates different structures, e.g. renames "MyApp.exe" to "lib.exe" which is not what I want; and renames folder "MyApp/" to "lib/" which is not what I want. I simply want to rename "_internal" to "lib" so that my bundled program works, that is all. Continue reading...