EXE PLS #151906
Replies: 2 comments 3 replies
-
Hello, If you want to run your Python script without needing Python installed, you can use PyInstaller to package it into an For Windows UsersStep 1: Install PyInstallerFirst, install PyInstaller via pip. Open Command Prompt (cmd) and run: pip install pyinstaller If you get an error saying python -m ensurepip
python -m pip install --upgrade pip
python -m pip install pyinstaller Step 2: Navigate to Your Script’s FolderMove to the directory where your script is saved. For example, if it’s on your Desktop: cd C:\Users\YourName\Desktop Step 3: Convert to EXERun the following command: pyinstaller --onefile --windowed your_script.py Explanation of Options:
Once done, your (Optional) Add an IconIf you have an icon file ( pyinstaller --onefile --windowed --icon=your_icon.ico your_script.py (Optional) Reduce File SizePyInstaller-generated pyinstaller --onefile --windowed --upx-dir=upx your_script.py Step 4: Run the EXEOnce completed, go to the For Linux Users (Building for Windows using Wine)If you're on Linux and need to build a Windows Step 1: Install WineFirst, install Wine (a Windows compatibility layer). For Ubuntu/Debian:sudo apt update
sudo apt install wine For Arch:sudo pacman -S wine For Fedora:sudo dnf install wine Step 2: Install Windows Python via Wine
Step 3: Install PyInstaller in the Windows EnvironmentOnce Python is installed inside Wine, open the Wine Command Prompt: wine cmd Now, install PyInstaller: pip install pyinstaller If wine python -m ensurepip
wine python -m pip install --upgrade pip
wine python -m pip install pyinstaller Step 4: Build the EXEStill inside the Wine command prompt, navigate to your script’s location: cd C:\users\yourusername\desktop Then run: pyinstaller --onefile --windowed your_script.py If you need an icon: pyinstaller --onefile --windowed --icon=your_icon.ico your_script.py Step 5: Retrieve the EXEAfter PyInstaller finishes, your
You can now transfer this |
Beta Was this translation helpful? Give feedback.
-
Welcome to the GitHub Community, @FatallmS, we're happy you're here! You are more likely to get a useful response if you are posting your question(s) in the applicable category and are explicit about what your project entails--giving a few more details might help someone give you a nudge in the right direction. This post belongs to the Programming Help category. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Python
Hello, I wrote a code via artificial intelligence and it works as I wanted. It calculates the spine of the books and gives an average size, but I couldn't convert it to exe or portable to run it without python. Can anyone help?
NOTE: I tried py to exe and couldn't run it.
https://gist.github.com/FatallmS/7b417511e11efc5e18bf264bebe61534
Beta Was this translation helpful? Give feedback.
All reactions