I installed a new module and it appears as if one of its dependencies was not already installed. The module is called Xlib.display. Here is the error message I received:
from Xlib.display import Display
ImportError: No module named Xlib.display
Where can I find this module that I am apparently lacking? Google yielded no leads.
"Edit: I already have that sourceforge module downloaded but I still get the same resutls.
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:
Xlib was still undetectable by python2. The solution in my case was to use:
Then find the package from the anaconda api, mine was erik/python-xlib. Install it using:
Then it worked.
Scenario:
I was trying to use screenshot functionalities of
pyautogui
package. I was getting this error:Python code (
test_screenshot.py
):Environment:
requirements.txt:
Solution:
I installed
python-xlib
package in the conda environment using:Now
test_screenshot.py
is running without any error.Updated
requirements.txt
:I honestly cant explain why this works... but here is the command that got it working for me.
Should not work because xlib apparently does not work with python 3.x, but everything installed alright, so I'm not complaining!
Below worked for me!
I have also used pyuserinput for automation which requires this.
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
I don't think the Xlib library works in Python 3.
Source: