This article demonstrates how to use the pyi-grab_version
tool to extract version information from applications, and how to use the pyi-set_version
tool to add version information to applications.
File Version Information
Windows applications may contain version information that describes the executable file's properties:

By default, files generated by PyInstaller do not contain this information.
pyi-grab_version Usage
The pyi-grab_version
tool can extract version information from any Windows executable file that contains it. The syntax is:
pyi-grab_version exe-file [out-filename]
exe-file
: Path to the executable file containing version information (will error if none exists)out-filename
: File to save the information to (default:file_version_info.txt
)
Here's sample version information extracted from python.exe
:
# UTF-8 # # For more details about fixed file info 'ffi' see: # http://msdn.microsoft.com/en-us/library/ms646997.aspx VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. filevers=(3, 11, 5150, 1013), prodvers=(3, 11, 5150, 1013), # Contains a bitmask that specifies the valid bits 'flags'r mask=0x3f, # Contains a bitmask that specifies the Boolean attributes of the file. flags=0x0, # The operating system for which this file was designed. # 0x4 - NT and there is no need to change it. OS=0x4, # The general type of file. # 0x1 - the file is an application. fileType=0x1, # The function of the file. # 0x0 - the function is not defined for this fileType subtype=0x0, # Creation date and time stamp. date=(0, 0) ), kids=[ StringFileInfo( [ StringTable( '000004b0', [StringStruct('CompanyName', 'Python Software Foundation'), StringStruct('FileDescription', 'Python'), StringStruct('FileVersion', '3.11.5'), StringStruct('InternalName', 'Python Console'), StringStruct('LegalCopyright', 'Copyright © 2001-2023 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.'), StringStruct('OriginalFilename', 'python.exe'), StringStruct('ProductName', 'Python'), StringStruct('ProductVersion', '3.11.5')]) ]), VarFileInfo([VarStruct('Translation', [0, 1200])]) ] )
You can directly modify this information for your own program. The file may contain Unicode characters - edit and save using utf-8
encoding.
When using pyinstaller
, add the --version-file
option to bundle the version resource with your application:
pyinstaller -F --version-file file_version_info.txt main.py
Alternatively, use pyi-set_version
to add version information after building your application.
pyi-set_version Usage
pyi-set_version
adds version information to applications. The syntax is:
pyi-set_version info-file exe-file
pyi-set_version
works with all exe/dll files;
Existing version information will be updated if present;
info-file
: Text file containing version informationexe-file
: Executable file to receive version information