This tool automates the setup process to transform Python files that use the Playwright library into a onefile executable for Windows (.exe). It creates a virtual environment, installs dependencies from requirements.txt
, packages Chromium with your application, configures the Playwright PATH for executable conversion, and initiates auto-py-to-exe.
Follow these steps to easily convert your Python scripts into standalone executables:
Right-click here and select "Save link as..." to download the requirements.txt
file. Choose the empty directory where you wish to save it.
- Edit the
requirements.txt
file by adding any additional libraries your project requires under section "2"; - Save the file after editing.
Navigate to the empty folder where you saved the requirements.txt
file in step "1" and open PowerShell in that location.
Paste the following command into PowerShell and execute it:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex "&{$((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/A-Assuncao/playwright-to-exe/main/setup_install_venv.ps1'))}"
This solution was inspired by a step-by-step guide created by Animesh Singh on Medium.com. You can read the original guide here. Many thanks to Animesh Singh for providing the detailed instructions that formed the basis for this automated process!