Why does my pyinstaller created executable require admin privileges?

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.

  • 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.


    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 much 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.

    链接地址: http://www.djcxy.com/p/58656.html

    上一篇: html导出不同的分支

    下一篇: 为什么我的pyinstaller创建的可执行文件需要管理员权限?