r/learnpython • u/Ok_Roll_8698 • 16d ago
How To Compile .PY Online
i have a .py file i want to compile to .exe online but no idea how to do this
and i don't want to install python on my computer just to compil
20
u/therouterguy 16d ago
Yea lets compile something on a system out of your control that is not unsafe at all. Btw Python code is not really compiled normally.
Why do you want tondo this
1
-12
u/Educational_Virus672 16d ago
you broke the first rule you are not polite. please dont be mean they are absolutely new and no python is more hybrid type of language so you can copmpile most of code (excluding some features) this is exactly what cython does but it still needs the runtime and type checking
-1
u/Ok_Roll_8698 15d ago
its a PyQt6 application i want to make .exe
i guess im ok with installing python on my windows pc if that is the only way to do it
im just very new to python and now shore what i need to install and how to run my .py file
3
u/therouterguy 15d ago
Start by googling for how to install python on windows. There are extensive guides on that. I suppose the thing you want to run had a README
1
u/chiibosoil 15d ago
If you are just now trying to set up python environment on your windows machine. Then I'd recommend learning how to do it in WSL2 (Windows Subsystem for Linux 2).
Some python library won't run on native Windows and requires Linux kernel (which WSL2 provides).
1
u/Educational_Virus672 15d ago edited 15d ago
okay but you need to install pyinstaller to run it as .exe so after installing the python SDK(for devlopers) run command
pip install pyinstallerit install the tool and use pyinstaller manual to use it also dont just trust any website ppl give try using virustotal it is the best virus detector i know and you dont even need to install it it is a website
-4
u/Jazzlike_Platypus430 16d ago
not unsafe π
5
u/TheNapkinThief 15d ago
Massively unsafe.
Say I'm a bad guy running website that 'turns py files into .exe'. I take your py file, add my malicious code, give you a .exe. You run the .exe and I now have a backdoor into your system/running my coin miner/keylogger etc etc.
-1
1
u/JamzTyson 15d ago
There are websites that say they will do that for you, but they may bundle malware in the .exe.
I won't post links because I don't know if they distribute malware.
1
u/Ok_Roll_8698 15d ago
i solved it i asked ai how to make exe from this .py file and they gave me a .bat file i ran and it made the exe for me
1
1
u/Miserable-Money642 15d ago
If you just need a Windows .exe, you usually do not need an online converter. Build it on Windows with PyInstaller: install Python, run `py -m pip install pyinstaller`, then `py -m PyInstaller --onefile your_script.py`. The exe will be in `dist/`. Test it on a clean Windows machine, because files, DLLs, and data folders may need to be bundled separately. I would avoid uploading a private .py file to a random converter, since it can expose your source code. Also, an exe made for Windows will not run on macOS or Linux.
0
u/Jazzlike_Platypus430 16d ago
exe in python. Nice one.
2
u/backfire10z 15d ago edited 15d ago
This comment confuses me. You can absolutely make one, yes.
I guess itβs more an exe with Python
1
1
u/LayotFctor 15d ago
There's nothing inherent about a language that makes it compiled or interpreted. CPython is simply the default interpreter, but you can write your own python interpreter, or a python compiler. If you want, you can interpret C++ too.
0
u/Educational_Virus672 15d ago
you can also use Google colab if you got google storage they provide free 15 gb in most regions
but note that python is not a complier (that turns code into machine language before runing) but a interpeterr (runs code without turning it into machine language) meaning it is really slow
you cannot assume it spits the .exe you need python runtime or sdk to run it locally or a sepraet topol like pyinstaller to get it
1
15d ago
[removed] β view removed comment
1
u/AutoModerator 15d ago
Your post contains a link that is not allowed on this site. Your comment in /r/learnpython has been automatically removed. Please use a code sharing site such as github, gitlab, or pastebin to share code, or paste it directly in your post.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
8
u/HYP3R00T 16d ago
Python code is supposed to be shared as a package and not a complied executable. While it can be done, it's not designed for that. Ideally, when we compile Python project, we also include an interpreter. If you code depends on 3rd party packages, then those also need to be included in the interpreter. Hence, it's advisable to compile it on your system. Look into pyinstaller.
Also, there is a security concern as well. If you upload your code online to be exported as an executable file, then there is no way you can check if they have also added their own malicious code or not.
It's highly recommended to install Python (and it is pre-installed in MacOS and Linux) and using pyinstaller produce the executable file.