From b4098737b13c91ca85b69362426f0f30768c49b1 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 11 Jun 2019 16:23:10 +0200 Subject: Doc: Minor language edits - reordered a few sentences - removed a few redundant bits Change-Id: I111dc51b7912a056ec8d9dc3bc765e9d374b6060 Reviewed-by: Cristian Maureira-Fredes --- sources/pyside2/doc/deployment-pyinstaller.rst | 80 +++++++++++++------------- 1 file changed, 41 insertions(+), 39 deletions(-) (limited to 'sources/pyside2/doc/deployment-pyinstaller.rst') diff --git a/sources/pyside2/doc/deployment-pyinstaller.rst b/sources/pyside2/doc/deployment-pyinstaller.rst index f361daf4a..7a720f558 100644 --- a/sources/pyside2/doc/deployment-pyinstaller.rst +++ b/sources/pyside2/doc/deployment-pyinstaller.rst @@ -2,12 +2,12 @@ |project| & PyInstaller ======================= -`PyInstaller `_ allows you to freeze your python +`PyInstaller `_ lets you freeze your python application into a stand-alone executable. The supported platforms are Linux, macOS, Windows, FreeBSD, and others. One of the main goals of `PyInstaller` is to be compatible with 3rd-party -Python modules, e.g.: |pymodname|. +Python modules, for example: |pymodname|. You can read the `official documentation `_ to clarify any further question, and remember to contribute to @@ -17,7 +17,7 @@ by filing issues if you find any, or contributing to their development. Preparation =========== -Installing `PyInstaller` can be done via **pip**:: +Installing `PyInstaller` can be done using **pip**:: pip install pyinstaller @@ -26,12 +26,11 @@ installing `PyInstaller` into it. After the installation, the `pyinstaller` binary will be located in the `bin/` directory of your virtual environment, or where your Python executable is located. +If that directory is not in your `PATH`, include the whole path when executing `pyinstaller`. -If that directory is not in your `PATH`, you need to include the whole path -when executing `pyinstaller`. - -.. warning:: If you already have PySide2 or Shiboken2 installed in your system, PyInstaller will pick them - instead of your virtual environment ones. +.. warning:: If you already have a PySide2 or Shiboken2 version installed in your + system path, PyInstaller will pick them instead of your virtual environment + version. Freezing an application ======================= @@ -41,13 +40,12 @@ To learn more about them you can just run `pyinstaller -h`. Two main features are the option to package the whole project (including the shared libraries) into one executable file (`--onefile`), -and to prepare a directory that will contain -an executable next to all the used libraries. +and to place it in a directory containing the libraries. Additionally, for Windows you can enable opening a console during the -execution with the option `-c` (or equivalent `--console` or `--nowindowed`). +execution with the option, `-c` (or equivalent `--console` or `--nowindowed`). Further, you can specify to not open such console window -on macOS and Windows with the option `-w` (or equivalent `--windowed` or `--noconsole`). +on macOS and Windows with the option, `-w` (or equivalent `--windowed` or `--noconsole`). Creating an example ------------------- @@ -93,32 +91,33 @@ Now, consider the following simple script, named `hello.py`:: sys.exit(app.exec_()) -Since it has a UI, we will use the `--windowed` option. +As it has a UI, you will use the `--windowed` option. -The command line to proceed will look like this:: +The command line to proceed looks like this:: pyinstaller --name="MyApplication" --windowed hello.py -This process will create a `dist/` and `build/` directory. -The executable and all the shared libraries required by your application -will be placed inside `dist/MyApplication`. +This process creates a `dist/` and `build/` directory. +The application executable and the required shared libraries are +placed in `dist/MyApplication`. -To execute the frozen application you can go inside `dist/MyApplication` and +To run the application you can go to `dist/MyApplication` and execute the program:: cd dist/MyApplication/ ./MyApplication -.. note:: The directory inside `dist/` and the executable will have the same name. +.. note:: The directory inside `dist/` and the executable will have +the same name. -If you prefer to have everything bundled into one executable, i.e.: -no shared libraries next to the executable, you can use the option +If you prefer to have everything bundled into one executable, +without the shared libraries next to it, you can use the option `--onefile`:: pyinstaller --name="MyApplication" --windowed --onefile hello.py -This process will take a bit longer, but in the end you will discover -an executable inside the `dist/` directory that you can execute:: +This process takes a bit longer, but in the end you will have one +executable in the `dist/` directory:: cd dist/ ./MyApplication @@ -131,26 +130,29 @@ Current Caveats To Be Aware Of PyInstaller Problem ------------------- -As already mentioned, `PyInstaller` will pick a system installation of PySide2 or -Shiboken2 instead of your virtualenv version without notice, if it exists. -This may be no problem if those PySide2 or shiboken2 versions are the same. - -If you are working with different versions, this can result in frustrating sessions, -when you think you are testing a new version, but `PyInstaller` -is silently working with a different, older version. +As already mentioned, `PyInstaller` will pick a system installation +of PySide2 or Shiboken2 instead of your virtualenv version without +notice, if it exists. This may not be a problem if those two +versions are the same. +If you are working with different versions, this can result in +frustrating debugging sessions. You could think you are testing the +latest version, but `PyInstaller` could be working with an older +version. Problem with numpy in Python 2.7.16 ----------------------------------- -A recent problem of PyInstaller is the appearance of Python 2.7.16 . -This Python version creates a problem that is known from Python 3 as a `Tcl/Tk` problem. -This does rarely show up in Python 3 because `Tcl/Tk` is seldom used with `PyInstaller. +A recent problem of PyInstaller is the appearance of Python 2.7.16. +This Python version creates a problem that is known from Python 3 +as a `Tcl/Tk` problem. This does rarely show up in Python 3 because +`Tcl/Tk` is seldom used with `PyInstaller. -On Python 2.7.16, this problem is very much visible, since many people are using numpy. -For some reason, installing `numpy` creates a dependency of `Tcl/Tk`, which can -be circumvented only by explicitly excluding `Tcl/Tk` related things by adding -this line to the analysis section of the spec-file:: +On Python 2.7.16, this problem is very much visible, as many are +using numpy. For some reason, installing `numpy` creates a +dependency to `Tcl/Tk`, which can be circumvented only by explicitly +excluding `Tcl/Tk` related things by adding this line to the analysis +section of the spec-file:: excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], @@ -162,12 +164,12 @@ o When using `PyInstaller` with `virtualenv`, make sure that there is no system installation of PySide2 or shiboken2. o Before compiling, use `pip -uninstall pyside2 shiboken2 -y` multiple times, until - none of the programs is found anymore. + none of the programs are found anymore. o Pip is usually a good tool. But to be 100 % sure, you should directly remove the PySide2 and shiboken2 folders from site-packages. o Be sure to use the right version of pip. The safest way to really run the right - pip, use the Python that you mean: Instead of the pip command, better use:: + pip, is to use the Python that you mean: Instead of the pip command, better use:: python -m pip -- cgit v1.2.3