Does executable file created using pyinstaller require Python and other modules installed on PC?

Question:

I created an executable file(.exe) using pyinstaller.
If I have to share it, does the other computer require Python and other modules installed?

Asked By: Mayank

||

Answers:

Pyinstaller just compress all the libraries and the code into one executable file, so no. But If you want other to run your Python file, they do need the libraries you used in your code. You can use some arguments with Pyinstaller to make it one executable file.

pyinstaller -F <my_file> # -F == one file

For More information about Pyinstaller and his features, you can read the manual here or just use the help argument with Pyinstaller

pyinstaller -h
Answered By: user13847364

Although this question was asked a while ago, I hope this helps others who are getting started with PyInstaller. The target system does not require Python to run a PyInstaller generated executable. You can combine all the modules into a single native executable with the --onefile option, as mentioned before, but you still need to consider a few things when running the generated executable on other systems.

Some considerations include the target architecture (32-bit vs. 64-bit, x86 vs. ARM, etc.), and the version of Python that PyInstaller used to build the executable. Also, it does not give you a fully static binary. The executable is dynamically linked and depends on the target system’s libc. You can read more about this here: https://github.com/pyinstaller/pyinstaller/wiki/FAQ#gnulinux.

I have had the most success by running PyInstaller to create executables on the target system I intend to run them on, and with earlier versions of Python/GLIBC.

Answered By: Michael Martin