To execute a Python script on a Windows 10 machine using XAMPP, you will need to follow these steps:
Download and install XAMPP on your machine. This will install Apache and MySQL on your system, which are necessary for running a Python script using XAMPP.
Open the XAMPP control panel and start the Apache and MySQL modules.
Create a new folder in the “htdocs” directory within the XAMPP folder (typically located at “C:\xampp\htdocs“). This will be the root directory for your Python script.
Place your Python script in the newly created folder.
In a web browser, navigate to “http://localhost/[foldername]/[scriptname].py“. Replace [foldername] with the name of the folder you created in step 3 and [scriptname] with the name of your Python script.
Step 2.5: Add Python extension to default page locations (Optional)
httpd.conf file search for
<IfModule dir_module> to add
index.py among others to the list of default page locations.
Your script will be executed, and the output will be displayed in the browser.
Step 3: Restart Apache / XAMPP
If Apache was running while editing, now is the time to restart it.