r/pythonhelp • • Jan 09 '23

Running Python reliably on a Windows computer without installing Python

This is probably going to sound a little convoluted, but this might be a solution to a problem I'm encountering with Python software I'm creating and distributing at work...

I'm wondering...instead of creating an executable or installing Python using its normal installer file, I thought maybe I could manually copy over the Python interpreter and associated files, including the Lib and the Scripts folder. The interpreter and associated files will already be configured properly (e.g., any needed libraries will already be installed).

On this computer, I want to create a batch file for the user to run my code. (It'd just point to the Python interpreter and to the Python code I've written.)

I tested this and it seems to work...I know this probably sounds like a needlessly complicated process, but it may be simpler than my alternatives.

Is this likely to work reliably, or are there problems I'm going to encounter here that I haven't thought of?

Thanks!

2 Upvotes

4 comments sorted by

View all comments

1

u/Zeroflops Jan 09 '23

Better to just creat a py exe file which does all this in one executable file. Pyinstaller is one option but there are others.

An alternative would be to make your app web based and serve it from a common location.

1

u/therealdeal6 Jan 10 '23

I do think a web app would be better, but I don't have the skills to build anything like that...yet!

I'm trying to avoid exe files if I can. These have to be allowed by our IT department on all of the computers, and it could be quite a lot, since these computers are pretty locked down. Batch files do not require any kind of administrator permission.

I was just doing a little out-of-the-box thinking. I wondered if it might be a little trickier to set up initially, but in the end be easier to get out to the many computers. No need to manually allow an exe file on every machine. But it may very well just be adding extra steps to the process that aren't really justified.