| 1 |
OS package |
| 2 |
========== |
| 3 |
|
| 4 |
Python-evdev has been packaged for the following distributions: |
| 5 |
|
| 6 |
.. raw:: html |
| 7 |
|
| 8 |
<a href="https://repology.org/project/python:evdev/versions"> |
| 9 |
<img src="https://repology.org/badge/vertical-allrepos/python:evdev.svg?exclude_sources=modules,site&exclude_unsupported=1" alt="Packaging status"> |
| 10 |
</a> |
| 11 |
|
| 12 |
Consult the documentation of your OS package manager for installation instructions. |
| 13 |
|
| 14 |
|
| 15 |
From source |
| 16 |
=========== |
| 17 |
|
| 18 |
The latest stable version of *python-evdev* can be installed from PyPi_, |
| 19 |
provided that you have a compiler, pip and the Python and Linux development |
| 20 |
headers installed on your system. The exact packages are distribution specific |
| 21 |
and typically falls into one of the following: |
| 22 |
|
| 23 |
On a Debian compatible OS: |
| 24 |
|
| 25 |
.. code-block:: bash |
| 26 |
|
| 27 |
$ apt install python-dev python-pip gcc |
| 28 |
$ apt install linux-headers-$(uname -r) |
| 29 |
|
| 30 |
On a RedHat compatible OS: |
| 31 |
|
| 32 |
.. code-block:: bash |
| 33 |
|
| 34 |
$ dnf install python-devel python-pip gcc |
| 35 |
$ dnf install kernel-headers-$(uname -r) |
| 36 |
|
| 37 |
On Arch Linux and derivatives: |
| 38 |
|
| 39 |
.. code-block:: bash |
| 40 |
|
| 41 |
$ pacman -S core/linux-api-headers python-pip gcc |
| 42 |
|
| 43 |
Once all OS dependencies are installed, you may use your preferred Python |
| 44 |
package manager to install *python-evdev*. For example: |
| 45 |
|
| 46 |
.. code-block:: bash |
| 47 |
|
| 48 |
# Using pip (user install). |
| 49 |
$ python3 -m pip install --user evdev |
| 50 |
|
| 51 |
# Using pip in a virtual environment. |
| 52 |
$ python3 -m venv venv_path && venv_path/bin/python3 -m pip install evdev |
| 53 |
|
| 54 |
# Using uv. |
| 55 |
uv add evdev # or uv pip install evdev |
| 56 |
|
| 57 |
|
| 58 |
Specifying header locations |
| 59 |
--------------------------- |
| 60 |
|
| 61 |
By default, the setup script will look for the ``input.h`` and |
| 62 |
``input-event-codes.h`` header files in ``/usr/include/linux``. |
| 63 |
|
| 64 |
The ``--evdev-headers`` option of the setuptools ``build_ext`` command |
| 65 |
overrides the header search location. It accepts one or more colon-separated |
| 66 |
paths. For example: |
| 67 |
|
| 68 |
.. code-block:: bash |
| 69 |
|
| 70 |
$ python3 setup.py build_ext \ |
| 71 |
--evdev-headers buildroot/input.h:buildroot/input-event-codes.h \ |
| 72 |
--include-dirs buildroot/ \ |
| 73 |
install # or any other command (e.g. develop, bdist, bdist_wheel) |
| 74 |
|
| 75 |
|
| 76 |
Binary wheels |
| 77 |
============= |
| 78 |
|
| 79 |
The `evdev-binary`_ package on PyPi provides binary wheels that have been |
| 80 |
compiled on `manylinux_2_34`_ (AlmaLinux 9, glibc 2.34, kernel 5.14.0). Wheels |
| 81 |
for musl-based systems are built on the `musllinux_1_2`_ image (Alpine Linux |
| 82 |
3.22). |
| 83 |
|
| 84 |
.. code-block:: bash |
| 85 |
|
| 86 |
$ python3 -m pip install evdev-binary |
| 87 |
|
| 88 |
While the evdev interface is stable, the precompiled version may not be fully |
| 89 |
compatible or expose all the features of your running kernel. For best results, |
| 90 |
it is recommended to use an OS package or to install from source. |
| 91 |
|
| 92 |
|
| 93 |
.. _PyPi: https://pypi.org/project/evdev |
| 94 |
.. _evdev-binary: https://pypi.org/project/evdev-binary |
| 95 |
.. _manylinux_2_34: https://github.com/pypa/manylinux |
| 96 |
.. _musllinux_1_2: https://peps.python.org/pep-0600/ |