jwalls91
jwalls91

Reputation: 351

How can I run a Python.exe on another computer that doesn't have Python installed?

I have a Python.exe file that I created using Pyinstaller. It runs fine when I execute it on my own PC, but if I move it to another PC on the network, it gives the error pop up message "Fatal error detected, Failed to execute script __".

I am needing to run this Python exe on any computer on the network even if they don't have Python installed.

I used the code below and it packages everything into one single .exe file in the dist folder.

pyinstaller -F -w script.py

I am needing to run this Python.exe on any computer on the network even if they don't have Python installed. Is this possible?

Upvotes: 1

Views: 11630

Answers (2)

jwalls91
jwalls91

Reputation: 351

I was able to find out the solution to this problem.

I re-ran pyinstaller without -w and saw the error message in cmd "InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified."

My script used pyodbc and I was researching around and saw to change the driver to "Driver={SQL Server};". I originally had it as "Driver={SQL Server Native Client 11.0};", so once I changed this to just SQL Server, the executable files ran fine on other machines.

Upvotes: 0

Szymon Maszke
Szymon Maszke

Reputation: 24691

Please notice that pyinstaller is tailored to the specific OS it was created in (it is especially dependent on C implementation, app created by PyInstaller on, say, ubuntu with glibc will be incompatible with alpine running musl). What's more, it is not standalone executable per se, it has Python interpreter bundled inside.

You can find some more info in pyinstaller docs.

Easiest workaround I have found is to use Docker and create your app with multistage build.

If that's not an option, you may have to use Cython or other approach.

Upvotes: 1

Related Questions