'How to run a python GUI created in pycharm using .bat [duplicate]
I wanted to ask help from this community for a solution for this: I made a python gui that I can run fine when using the terminal in pycharm. Now, I want to be able to run it through a .bat file (or a similar method) so that I don't have to go through opening pycharm everytime. This is because I will hand it over to someone who might not have pycharm installed in their pc, so just double clicking the .bat file will run the gui. I also want to restrict them from seeing my codes so running it by just clicking something would be ideal.
I have tried the ff methods so far but none of them worked for me: I wrote the ff in a notepad and saved them as a .bat file
First: start "" "location where my python is\python.exe" "location where my python file is\GUI.py"
second: @echo off "location where my python is\python.exe" "location where my python file is\GUI.py" pause
Is there a way to do this? Thanks a lot!!
Solution 1:[1]
This can be done in a text file. First you add the path to where your python exe is stored, then the path to where your python script is stored. Example:
"C:\Users\AppData\Local\Programs\Python\Python39\python.exe"
"C:\Users\Desktop\Test\foo.py"
save this file as a .bat instead of .txt and change "save as type" from txt file to all files. when saved correctly you can make a shortcut to your desktop to launch it from there. Hopfully this helps!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | liteversion |