2023-08-09 23:38:47 +00:00
|
|
|
.. _user_installation:
|
|
|
|
|
2015-12-27 15:56:51 +00:00
|
|
|
Installation
|
2023-08-08 22:52:01 +00:00
|
|
|
============
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2023-08-09 23:38:47 +00:00
|
|
|
:Last Reviewed: 2023-08-10
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
Installation with PIP
|
|
|
|
---------------------
|
2023-08-09 23:38:47 +00:00
|
|
|
Installation should be rather straight-forward. python-escpos is on PyPi,
|
|
|
|
so you can simply enter:
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
::
|
|
|
|
|
2023-08-16 23:37:50 +00:00
|
|
|
pip install python-escpos[all]
|
2016-07-23 09:34:18 +00:00
|
|
|
|
2023-08-09 23:38:47 +00:00
|
|
|
This should install all necessary dependencies. Apart from that
|
|
|
|
python-escpos is for some versions also available as a Debian package.
|
|
|
|
If you want to always benefit from the newest stable releases you should
|
|
|
|
always install from PyPi.
|
|
|
|
If you use the ``--pre`` parameter for ``pip``, you will get the latest
|
|
|
|
pre-release.
|
2016-07-23 09:34:18 +00:00
|
|
|
|
2023-08-16 23:37:50 +00:00
|
|
|
The following installation options exist:
|
|
|
|
|
|
|
|
* `all`: install all packages available for this platform
|
|
|
|
* `usb`: install packages required for USB printers
|
|
|
|
* `serial`: install packages required for serial printers
|
|
|
|
* `win32`: install packages required for win32 printing (only Windows)
|
|
|
|
* `cups`: install packages required for CUPS printing
|
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
Setup udev for USB-Printers
|
|
|
|
---------------------------
|
|
|
|
1. Get the *Product ID* and *Vendor ID* from the lsusb command
|
2023-08-09 23:38:47 +00:00
|
|
|
``# lsusb Bus 002 Device 001: ID 1a2b:1a2b Device name``.
|
|
|
|
(Or whichever way your system supplies to get the PID and VID.)
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
2. Create a udev rule to let users belonging to *dialout* group use the
|
2015-12-27 15:56:51 +00:00
|
|
|
printer. You can create the file
|
|
|
|
``/etc/udev/rules.d/99-escpos.rules`` and add the following:
|
|
|
|
``SUBSYSTEM=="usb", ATTRS{idVendor}=="1a2b", ATTRS{idProduct}=="1a2b", MODE="0664", GROUP="dialout"``
|
|
|
|
Replace *idVendor* and *idProduct* hex numbers with the ones that you
|
|
|
|
got from the previous step. Note that you can either, add yourself to
|
|
|
|
"dialout" group, or use another group you already belongs instead
|
|
|
|
"dialout" and set it in the ``GROUP`` parameter in the above rule.
|
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
3. Restart udev ``# sudo service udev restart`` In some new systems it
|
2015-12-27 15:56:51 +00:00
|
|
|
is done with ``# sudo udevadm control --reload``
|
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
Enabling tab-completion in CLI
|
|
|
|
------------------------------
|
|
|
|
python-escpos has a CLI with tab-completion. This is realised with ``argcomplete``.
|
|
|
|
In order for this to work you have to enable tab-completion, which is described in
|
|
|
|
the `manual of argcomplete <https://argcomplete.readthedocs.io>`__.
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
If you only want to enable it for python-escpos, or global activation does not work, try this:
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
::
|
2015-12-27 15:56:51 +00:00
|
|
|
|
2016-07-23 09:34:18 +00:00
|
|
|
eval "$(register-python-argcomplete python-escpos)"
|
2015-12-27 15:56:51 +00:00
|
|
|
|
|
|
|
|