KeyError: 'DISPLAY' when installing pyautogui
See original GitHub issueWhen I tried to install pyautogui with sudo pip3 install pyautogui
I get the error info
pi@raspberrypi:~/Desktop/test/c_test $ sudo pip3 install pyautogui Downloading/unpacking pyautogui Downloading PyAutoGUI-0.9.36.tar.gz (46kB): 46kB downloaded Running setup.py (path:/tmp/pip-build-tbxln81q/pyautogui/setup.py) egg_info for package pyautogui Traceback (most recent call last): File “<string>”, line 17, in <module> File “/tmp/pip-build-tbxln81q/pyautogui/setup.py”, line 6, in <module> version=import(‘pyautogui’).version, File “/tmp/pip-build-tbxln81q/pyautogui/pyautogui/init.py”, line 115, in <module> from . import _pyautogui_x11 as platformModule File “/tmp/pip-build-tbxln81q/pyautogui/pyautogui/_pyautogui_x11.py”, line 160, in <module> _display = Display(os.environ[‘DISPLAY’]) File “/usr/lib/python3.4/os.py”, line 633, in getitem raise KeyError(key) from None KeyError: ‘DISPLAY’ Complete output from command python setup.py egg_info: Traceback (most recent call last):
File “<string>”, line 17, in <module>
File “/tmp/pip-build-tbxln81q/pyautogui/setup.py”, line 6, in <module>
version=__import__('pyautogui').__version__,
File “/tmp/pip-build-tbxln81q/pyautogui/pyautogui/init.py”, line 115, in <module>
from . import _pyautogui_x11 as platformModule
File “/tmp/pip-build-tbxln81q/pyautogui/pyautogui/_pyautogui_x11.py”, line 160, in <module>
_display = Display(os.environ['DISPLAY'])
File “/usr/lib/python3.4/os.py”, line 633, in getitem
raise KeyError(key) from None
KeyError: ‘DISPLAY’
Cleaning up… Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-tbxln81q/pyautogui Storing debug log for failure in /root/.pip/pip.log
I followed the install steps listed in the Docs(http://pyautogui.readthedocs.io/en/latest/install.html). Do anyone know why this happens and how to fix it? Thank you so much.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
Top GitHub Comments
Have solved it. It is because of using ssh to install the package. When I install it by using the raspberrypi directly it solved.
Hello,
I do a mouse-reset.py like this for my magic mirror:
it’s work correctly when the mirror boot. but i need to pkill python when i want to power off the screen.
my problem: i can’t laucnh this in SSH: python3 /home/pi/programmes/mouse-reset.py
i have error display.
pyautogui test the client but not serveur display.
What i have to do to do this python program in SSH?
i test add it in a mouse.sh and do: bash /home/pi/scripts/mouse.sh but same problem: Error Display.
Please, i need help to activate this python program with SSH when i do bash /home/pi/scripts/ecran_on.sh
i want this program execute in ssh serveur, not in ssh client.
thank you for your help.