The syntax of the pyinstaller command is:

pyinstaller [options] script [script ...] | specfile

//You may give a path to the script or spec file, for example
pyinstaller options... ~/myproject/source/

//or, on Windows,
pyinstaller "C:\Documents and Settings\project\myscript.spec"


-F, --onefile
创建一个捆绑好的可执行文件。Create a one-file bundled executable.

-D, --onedir
创建一个文件夹包含可执行包(默认)。Create a one-folder bundle containing an executable (default)

指定存储生成的规范文件的文件夹。Folder to store the generated spec file (default: current directory)

-n NAME, --name=NAME
打包好的可执行文件的名字。Name to assign to the bundled app and spec file (default: first script's basename)



-p DIR, --paths=DIR
A path to search for imports (like using PYTHONPATH). Multiple paths are allowed, separated by ':', or use this option multiple times

Name an import not visible in the code of the script(s). This option can be used multiple times.

An additional path to search for hooks. This option can be used multiple times.

Path to a custom runtime hook file. A runtime hook is code that is bundled with the executable and is executed before any other code or module to set up special features of the runtime environment. This option can be used multiple times.

Optional module or package (his Python names,not path names) that will be ignored (as thoughit was not found).This option can be used multiple times.

The key used to encrypt Python bytecode.


-d, --debug
Tell the bootloader to issue progress messages while initializing and starting the bundled app. Used to diagnose problems with missing imports.

-s, --strip
在可执行程序和共享库应用一个符号表条(不建议用于Windows)。Apply a symbol-table strip to the executable and shared libs (not recommended for Windows) --noupx Do not use UPX even if it is available (works differently between Windows and *nix)

Windows和Mac OS X特定选项

-c, --console, --nowindowed
显示控制台窗口(默认)。Open a console window for standard i/o (default)

-w, --windowed, --noconsole
不显示控制台窗口(背景黑色的窗口)。Windows and Mac OS X: do not provide a console window for standard i/o. On Mac OS X this also triggers building an OS X .app bundle.This option is ignored in *NIX systems.

-i <FILE.ico or FILE.exe,ID or FILE.icns>, --icon=<FILE.ico or FILE.exe,ID or FILE.icns>
加入图标。FILE.ico: apply that icon to a Windows executable. FILE.exe,ID, extract the icon with ID from an exe. FILE.icns: apply the icon to the .app bundle on Mac OS X


add a version resource from FILE to the exe

-m <FILE or XML>, --manifest=<FILE or XML>
add manifest FILE or XML to the exe

Add or update a resource of the given type, name and language from FILE to a Windows executable. FILE can be a data file or an exe/dll. For data files, at least TYPE and NAME must be specified. LANGUAGE defaults to 0 or may be specified as wildcard * to update all resources of the given TYPE and NAME. For exe/dll files, all resources from FILE will be added/updated to the final executable if TYPE, NAME and LANGUAGE are omitted or specified as wildcard *.This option can be used multiple times.

Using this option creates a Manifest which will request elevation upon application restart.

Using this option allows an elevated application to work with Remote Desktop.

Mac OS X的特定选项

Mac OS X .app bundle identifier is used as the default unique program name for code signing purposes. The usual form is a hierarchical name in reverse DNS notation. For example: com.mycompany.department.appname (default: first script's basename)




posted @ 2015-08-23 16:56  osfipin  阅读(1684)  评论(0编辑  收藏  举报