'DISPLAY'错误Python,pyautogui Linux:POP_OS

时间:2019-02-17 14:54:13

标签: python pyautogui

我正在使用Google Colaboratory IDE。 当我运行此代码时:

!sudo pip3 install python3-xlib
!sudo apt-get install python3-tk
!sudo apt-get install python3-dev
!pip3 install pyautogui
import pyautogui

我得到了错误:

KeyError                                  
Traceback (most recent call last)

<ipython-input-19-fa2587ca3a04> in <module>()
----> 1 import pyautogui

/usr/local/lib/python3.6/dist-packages/pyautogui/__init__.py in <module>()
    142     from . import _pyautogui_win as platformModule
    143 else:
--> 144     from . import _pyautogui_x11 as platformModule
    145 
    146 

/usr/local/lib/python3.6/dist-packages/pyautogui/_pyautogui_x11.py in <module>()
    158 
    159 # Taken from PyKeyboard's ctor function.
--> 160 _display = Display(os.environ['DISPLAY'])
    161 
    162 

/usr/lib/python3.6/os.py in __getitem__(self, key)
    667         except KeyError:
    668             # raise KeyError with the original key value
--> 669             raise KeyError(key) from None
    670         return self.decodevalue(value)
    671 

KeyError: 'DISPLAY'

我正在使用POP_OS! ,这是Linux发行版。

0 个答案:

没有答案