How do I make python portable?
I want to make a portable application that will have executable code and python that will work on any Windows even if python is not installed.
I would like it to be python 3.6 and so it only installed pip
and setup tools
.
EDIT: regarding a duplicate
not really. I don't want to compile the code. I wanted to give them the files .py
, but understand that Windows won't have python installed by default. I want something that can be carried around with a flash drive, but will run my code from source, not binary.
source to share
Please correct me if I misunderstood this. I think there are at least two ways to do this. Let's say you have one portable_run.py script that you want to run everywhere on flashdisk.
-
Create exe file using pyinstaller eg. you can get an exe file like portable_run.exe. On the target windows system, you need to execute exe direcltly
protable_run.exe
-
Use a portable python distribution like winpython or python-xy. you just need to copy this portable distro to a flash drive along with your portable_rune .py. To run it on the target system
flashdisk/path-of-winpython/python portable_run.py
Hope this can give you some idea.
source to share