10

So I can use PyInstaller to make a one-file executable and to make a standard executable among other files in a folder.

But how do I turn Python files into an MSI installer so that it's fool-proof where it makes a shortcut on the desktop? (For distribution so that it isn't required for the user to have Python installed)

(When I say Python files to an MSI installer I mean the regular PyInstaller to folder output but with a way of getting a shortcut to the executable onto the desktop very easily for a regular user) (It doesn't have to be PyInstaller if there's an alternative).

Xantium
  • 11,201
  • 10
  • 62
  • 89
HelloThereToad
  • 249
  • 1
  • 3
  • 14
  • Isn't this a duplicate of https://stackoverflow.com/questions/37219045/windows-run-python-command-from-clickable-icon – sophros Jun 15 '18 at 16:46
  • 1
    I'm trying to do it as an executable. So that it doesn't require Python to be installed. I'm not asking how to make a shortcut, I'm asking how to turn Python files into an installer that can be launched by anyone + It should create a shortcut on the desktop automatically. – HelloThereToad Jun 15 '18 at 17:34

2 Answers2

7

Pyinstaller does not intergrate such a tool.

You could get a third party installer (some suggested here How to create a robust, minimal installer for Windows?) and add your output exe to it and install that way, if you choose the right tool you will be able to add to desktop (plus a lot of other actions such as adding to path ect).

Or you could use cx_Freeze which has it built in. When running the setup script just add the bdist_msi flag.

It can add to shortcut desktop but is fairly limited in other ways (or you may need to perform some hack).

To add to desktop with cx_Freeze see Use cx-freeze to create an msi that adds a shortcut to the desktop.

Xantium
  • 11,201
  • 10
  • 62
  • 89
  • cx_freeze is just bad. I've been tinkering with it for a decade, lack of documentation and many unanswered questions here on StackOverflow. i suggest you do not plan anything serious like big project relay on it – greendino Jun 12 '20 at 15:21
  • @AbdullahSaid I honestly have used it a ton. Whenever I need to convert Python I use CX_Freeze. Then again I know the Python file system extremely well, so I can tinker around with the setup script until it's working. My main reason for using it, is that it's maintained. Unlike most of the alternatives – Xantium Jun 12 '20 at 15:44
3

You can use Inno which creates a shortcut on the desktop and start menu. Also, it is located in the program directory of windows. it means that you can install/uninstall it like other programs or applications.

Mohammad
  • 339
  • 3
  • 6