Frage

I've written a Python program which I distribute using pyinstaller. I've been using the onefile option so far to create a standalone executable. That's been great up until now, but as the application has grown the startup time is getting a bit long. I'd also like users to install the application properly to make upgrading simpler.

I've been trying to create a single directory version of the app using pyinstaller's onedir option. However, the resulting .exe file that is created requires admin privileges to run, which the onefile version did not. The program itself doesn't need any such privileges so I assume this is something that pyinstaller is doing. How do I create an application that doesn't require admin privileges?

Additional info:

  • Python 2.6, pyinstaller v1.4
  • Application uses PyQt4 and pygame modules.
  • Trying to create executable for Windows 7.
  • Using -w pyinstaller option to create a windowless executable.
War es hilfreich?

Lösung

I have recently run into this issue, and my experience in solving it was thus:

PyInstaller with --onefile option creates a manifest file in the 'executable'. This manifest file on Windows tells the OS a few things about the application it is bundled with. One of the things it specifies, is the application name/manifest file. The format of the manifest filename is appname.exe.manifest. If your program is frozen with PyInstaller, the executable name that it stores in the manifest will be the name given to the completed EXE under the /dist folder of PyInstaller. IF you rename the EXE, the manifest file packed with it is no longer matching! Therefore, create a manifest file with the same name as the final EXE filename and run PyInstaller with the --manifest option, OR don't rename the EXE that PyInstaller creates.

When you package the PyInstaller project with the custom --manifest, the renamed program no longer requests administrator elevation.

Andere Tipps

admin privileges could be asked in few cases:

A. if the executable name contains relevant keywords (like setup, install, update or patch)

B. the application requests it in it's manifest.

C. the .exe file name do not match the name in the manifest file.

if you create a .spec file for your application package, you can add

exe = EXE(
    ...
    manifest=None,
    ...
    )

and it won't ask for password, unless you rename it to setup or install.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top