尝试在Colab中导入pyatogui时,为什么会出现此错误?

问题描述

!sudo apt install tesseract-ocr

!pip install PyTesseract

!pip install pyinstaller

!pip install pyautogui

!pip install pillow

!pip install python3_xlib python-xlib

这就是我第一个单元格中的东西。

然后,当我尝试导入pyautogui时,它显示错误

ConnectionRefusedError                    Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/Xlib/support/unix_connect.py in get_socket(dname,protocol,host,dno)
    118             try:
--> 119                 s = _get_unix_socket(address)
    120             except socket.error:

10 frames
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception,another exception occurred:

ConnectionRefusedError                    Traceback (most recent call last)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception,another exception occurred:

displayConnectionError                    Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/Xlib/support/unix_connect.py in get_socket(dname,dno)
    125                     raise
    126     except socket.error as val:
--> 127         raise error.displayConnectionError(dname,str(val))
    128 
    129     # Make sure that the connection isn't inherited in child processes.

displayConnectionError: Can't connect to display ":0": [Errno 111] Connection refused

我想这与colab无法连接到我的计算机有关,但我不知道。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)