r/pythonhelp • u/skahaggus • 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!
1
u/carcigenicate Jan 09 '23
This is what it does when you create an executable (assuming you aren't compiling the Python down to native bytecode). It just packages the interpreter with your code.