r/learnpython • • 8h ago

Creare app sul computer

Ciao a tutti, sto imparando a usare python, solitamente eseguo il codice dentro spider ma vorrei proprio creare delle app eseguibili dal desktop (ho windows)

4 Upvotes

3 comments sorted by

2

u/AgitatedTumbleweed65 5h ago

Pyinstaller is one option, you package depencies and a version of python interpreter along with your code into and executable. but the executables are large and can be slow on start up. Other options are some python to compiled languages translators that then compile in that translateed language, for sure there is a number of those that exists.

Edit:typos

1

u/socal_nerdtastic 7h ago edited 7h ago

If you install python from the official python.org site, and install it with the default options, you can just doubleclick any .py file to run it. If your program has a graphical interface and you don't want the terminal to show up, rename the file with a .pyw extension. You can manage your venvs (if you are using them) with the shebang in the file.

Another option is to make a windows shortcut or bat file that points to your python executable and file. I made a small python program that helps with that: https://github.com/socal-nerdtastic/pyshortcut

Alternatively, you can use 'freezing' programs like PyInstaller to make executables from your python code. https://www.reddit.com/r/learnpython/wiki/faq/?screen_view_count=1#wiki_how_do_i_create_an_executable_from_my_python_code.3F

1

u/Agawell 7h ago

Run it from the command line or create a shortcut that runs it from the command line