Problems importing python-Xlib Problems importing python-Xlib python python

Problems importing python-Xlib


Please try.

This shall install Xlib sudo apt-get install python-xlib

Then you can check

>>from Xlib.display import Display

To install PyMouse if you want to control and capture mouse events please use:

sudo easy_install https://github.com/pepijndevos/PyMouse/zipball/master


Below worked for me!

pip install python3_xlib

I have also used pyuserinput for automation which requires this.


I was having the same problem, but the solutions above didn't work for me. Since I had installed python through the anaconda package, when I used:

sudo apt-get install  python-xlib

Xlib was still undetectable by python2. The solution in my case was to use:

anaconda search -t conda python-xlib

Then find the package from the anaconda api, mine was erik/python-xlib. Install it using:

conda install --channel https://conda.anaconda.org/erik python-xlib

Then it worked.