I want to import pyautogui using PyCharm but it keeps showing error:

Traceback (most recent call last):
  File "/root/PycharmProjects/untitled2/ghea.py", line 1, in <module>
    import pyautogui
  File "/root/PycharmProjects/untitled2/venv/lib/python3.7/site-packages/pyautogui/__init__.py", line 152, in <module>
    from . import _pyautogui_x11 as platformModule
  File "/root/PycharmProjects/untitled2/venv/lib/python3.7/site-packages/pyautogui/_pyautogui_x11.py", line 7, in <module>
    from Xlib.display import Display
ModuleNotFoundError: No module named 'Xlib'

There were some similar questions and I tried answers but none of them did work.

i tried:

sudo apt-get install python-xlib

pip install python3_xlib

sudo apt-get install python3-xlib

0 Answers