Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyInstaller UAC not working in onefile mode


Hello everybody.

I have a small python project and want to make it to single executable file. I am using...

  • Windows 7
  • Python 3.4
  • PyInstaller 3.2.1

My PyInstaller command is,

PyInstaller -y -w -F -n output_file_name --uac-admin --clean source_file.py

this command works properly. But single output file does not ask for admin rights when executed. And there's no shield mark on executable file icon.

When remove the -F option (equivalent to --onefile), output executable file has shield mark on its icon and ask me admin rights. But this is not what I want. I want a single executable file.

I found a manifest file (output_file_name.exe.manifest) in dist\output_file_name folder. So I did...

PyInstaller -y -w -F -n output_file_name --manifest output_file_name.exe.manifest --uac-admin --clean source_file.py

But this command doesn't work. Its single executable file still does not ask for admin rights.

I have removed PyInstaller and installed recent development version.

pip install git+https://github.com/pyinstaller/pyinstaller.git@develop

But the result is same. Its output doesn't have a shield mark on icon and does not ask admin rights.

Do you have any idea?

Please help me!

like image 517
passion053 Avatar asked Oct 15 '25 15:10

passion053


1 Answers

I found what's wrong!

The key point is...

  1. Install PyInstaller 3.0
  2. Manifest file must be located in dist folder where single excutable file located
  3. The name of manifest file must be same as output file.
  4. If manifest file is located in dist folder, no need to specify --manifest option. --uac-admin is enough.
  5. You can find manifest file at build folder.

Thank you.

like image 140
passion053 Avatar answered Oct 17 '25 06:10

passion053