Pyinstaller generate EXE file outside dist folder

2.2k views Asked by At

I'am using Pyinstaller package to build a python desktop app, however Pyinstaller seems to put the bundled exe file outside _internal folder is there a solution I can try ? Thanks in advance

output by Pyinstaller _internal folder structure

my goal is to package all the app in a folder (dist) that exe file must be inside _internal folder

2

There are 2 answers

1
lanhao945 On BEST ANSWER

From the update logs,on Pyinstaller's document:https://pyinstaller.org/en/stable/CHANGES.html#id2

it says:

Restructure onedir mode builds so that everything except the executable (and if you’re using external PYZ archive mode) are hidden inside a sub-directory. This sub-directory’s name defaults to but may be configured with a new --contents-directory option. Onefile applications and macOS bundles are unaffected. (#7713.pkg_internal.app)

It means: from the verison ,6.0.0, it will build with a dir named _interne,when you choose to build by onedir.

So,a simple way to go back,is , make the version no bigger than 6.0.0.such as 5.13.2. It works well for me.

Also ,from the github issue.Below:

https://github.com/pyinstaller/pyinstaller/pull/7713

Pyinstall may give us a way to build exe file (use onedir),no create a dir named _interne.But,I can not find it.

Sorry for that,English is not my mother tongue.I have tried my best to get the grammar correct.

0
AmirHosien On

sorry I'm not professional in English but I'm trying my best I had the same problem but I search the internet and I come to this conclusion that if you add --contents-directory "." to your cmd code the exe file and datas will be in one folder

but it's necessary to pass --onedir too

will be in one folder like this:

python -m PyInstaller --onedir --contents-directory "." file.py