faq.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. FAQs
  2. ====
  3. Building on other platforms
  4. ---------------------------
  5. NSIS can run on Linux, so you can build Windows installers without running
  6. Windows. However, if your package relies on compiled extension modules, like
  7. PyQt4, lxml or numpy, you'll need to ensure that the installer is built with
  8. Windows versions of these packages. There are two ways to do this:
  9. - Get the importable packages/modules, either from a Windows installation, or
  10. by extracting them from an installer. Copy them into a folder called
  11. ``pynsist_pkgs``, next to your ``installer.cfg`` file. pynsist will
  12. copy everything in this folder to the build directory.
  13. - Include exe/msi installers for those modules, and modify the ``.nsi`` template
  14. to extract and run these during installation. This can make your installer
  15. bigger and slower, and it may create unwanted start menu shortcuts
  16. (e.g. PyQt4 does), so the first option is usually better. However, if the
  17. installer sets up other things on the system, you may need to do this.
  18. When running on non-Windows systems, pynsis will bundle a 32-bit version of
  19. Python by default, though you can override this :ref:`in the config file <cfg_python>`.
  20. Whichever method you use, compiled libraries must have the same bit-ness as
  21. the version of Python that's installed.
  22. Alternatives
  23. ------------
  24. Other ways to distribute applications to users without Python installed include
  25. freeze tools, like `cx_Freeze <http://cx-freeze.sourceforge.net/>`_ and
  26. `PyInstaller <http://www.pyinstaller.org/>`_, and Python compilers like
  27. `Nuitka <http://nuitka.net/>`_.
  28. pynsist has some advantages:
  29. * Python code often does things—like using ``__file__`` to find its
  30. location on disk, or :data:`sys.executable` to launch Python processes—which
  31. don't work when it's run from a frozen exe. pynsist just installs Python files,
  32. so it avoids all these problems.
  33. * It's quite easy to make Windows installers on other platforms, which is
  34. difficult with other tools.
  35. * The tool itself is simpler to understand, and less likely to need updating for
  36. new Python versions.
  37. And some disadvantages:
  38. * Installers tend to be bigger because you're bundling the whole Python standard
  39. library.
  40. * You don't get an exe for your application, just a start menu shortcut to launch
  41. it.
  42. * pynsist only makes Windows installers.
  43. Popular freeze tools also try to automatically detect what packages you're using.
  44. pynsist could do the same thing, but in my experience, it's complex and often
  45. misses things, so for now it expects an explicit list of the packages
  46. your application needs.