We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionI'm looking for a tutorial on PyInstaller that will explain things like
- how to create .pkg files
- how to include/exclude modules
- how to include data开发者_开发技巧 files inside the install directory.
I cannot make much sense out of the standard PyInstaller documentation.
Both guides in the accepted answer seem outdated. PyInstaller now provides an executable script that allows you to do
pyinstaller your_script.py
wherever your_script.py
is located - instead of the old mode of copying your your_script.py
to wherever you copied the source code of PyInstaller.
Here's a brief, more recent guide that walks you through a simple Hello World example:
http://www.pythoncentral.io/pyinstaller-package-python-applications-windows-mac-linux/
Have you looked here: simplified tutorial
Or here: a bit longer tutorial
EDIT: Adding data files is implied in the second tutorial. If you use the second example just before the "Wrapping Up" section, along with the official documentation: Analysis, it looks like you'd specify your data-file dependencies as part of the "datas" subobject when calling the Analysis() function.
EDIT2: From official documentation: "Generally, you will not need to create your own PKGs, as the EXE will do it for you. This is one way to include read-only data in a single-file deployment, however. A single-file deployment including TK support will use this technique."
Example (should be roughly like this):
a = Analysis(...)
pyz = PYZ(a.pure)
pkg = PKG(a.pure, name="PackageName")
exe = EXE(pyz, pkg,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
...)
To Create one executable of your python script or project
create your script or project. To install pyinstaller on Windows type
pip install pyinstallerNow open command prompt and type the command
pyinstaller --onefile myscripy.pyYou will find a dist folder created. Browse dist folder and you will get .exe file of python script.
精彩评论