pip3安装pyautogui,错误代码1
pip3 install pyautogui, error code 1
我无法安装 pyautogui 我已经尝试了所有方法,例如
pip3 install pillow
也按照网站上的步骤进行操作 pyautogui website。这是我在安装时收到的消息。
root@alex-Ai:/# pip3 install pyautogui
Collecting pyautogui
Using cached PyAutoGUI-0.9.36.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/Xlib/xauth.py", line 42, in __init__
raw = open(filename, 'rb').read()
FileNotFoundError: [Errno 2] No such file or directory: '/root/.Xauthority'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-mvyjt7lg/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-mvyjt7lg/pyautogui/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-mvyjt7lg/pyautogui/pyautogui/_pyautogui_x11.py", line 160, in <module>
_display = Display(os.environ['DISPLAY'])
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/lib/python3/dist-packages/Xlib/protocol/display.py", line 61, in __init__
name, host, displayno)
File "/usr/lib/python3/dist-packages/Xlib/support/connect.py", line 93, in get_auth
return getattr(mod, modname).get_auth(sock, dname, host, dno)
File "/usr/lib/python3/dist-packages/Xlib/support/unix_connect.py", line 116, in new_get_auth
au = xauth.Xauthority()
File "/usr/lib/python3/dist-packages/Xlib/xauth.py", line 44, in __init__
raise error.XauthError('~/.Xauthority: %s' % err)
Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/root/.Xauthority'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mvyjt7lg/pyautogui/
@phd "sudo -H pip3 install pyautogui " 给我这个错误
alex@aimarket:/home$ sudo -H pip3 install pyautogui
Collecting pyautogui
Using cached PyAutoGUI-0.9.36.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-efkrhbdk/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-efkrhbdk/pyautogui/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-efkrhbdk/pyautogui/pyautogui/_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
ModuleNotFoundError: No module named 'Xlib'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-efkrhbdk/pyautogui/
PyAutoGUI
在 Unix 上需要 Xlib; the module xauth 尝试打开 ~/.Xauthority
即 /root/.Xauthority
并已加载。看来你是 运行 X Window 在非 root 用户下或根本不是 运行 它。
尝试为用户 运行 X11 安装 PyAutoGUI
。如果您确实需要以 root 身份安装,请通过 运行 sudo -H pip3 install pyautogui
.
为该非 root 用户保留 $HOME
env var
如果没有任何帮助,请将 XAUTHORITY env var 指向文件:
XAUTHORITY=/home/alex/.Xauthority pip3 install pyautogui
答案:pyautogui
对Ubuntu17.10不起作用,因为pyautogui
需要运行X11,所以你必须进入 Ubuntu 的登录屏幕并单击齿轮图标,在那里你将有两个选项,即 Ubuntu
或 Ubuntu on Xorg
单击 Xorg 上的 Ubuntu ,这将为您提供所需的 X11 功能。
更改后,您可以返回终端并运行 pip3 install pyautogui
,这已为我解决了。
pip install python-xlib
对我有用。
我使用了 pyvirtualdisplay
和 pyautogui
,当我尝试将其打包到 docker 时遇到了同样的错误。
use_xauth = True
参数在创建显示时帮助了我。
display = Display(visible=False, size=(800, 600), use_xauth=True)
别忘了安装 xauth
sudo apt-get install xauth
我无法安装 pyautogui 我已经尝试了所有方法,例如
pip3 install pillow
也按照网站上的步骤进行操作 pyautogui website。这是我在安装时收到的消息。
root@alex-Ai:/# pip3 install pyautogui
Collecting pyautogui
Using cached PyAutoGUI-0.9.36.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/Xlib/xauth.py", line 42, in __init__
raw = open(filename, 'rb').read()
FileNotFoundError: [Errno 2] No such file or directory: '/root/.Xauthority'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-mvyjt7lg/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-mvyjt7lg/pyautogui/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-mvyjt7lg/pyautogui/pyautogui/_pyautogui_x11.py", line 160, in <module>
_display = Display(os.environ['DISPLAY'])
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/python3/dist-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/lib/python3/dist-packages/Xlib/protocol/display.py", line 61, in __init__
name, host, displayno)
File "/usr/lib/python3/dist-packages/Xlib/support/connect.py", line 93, in get_auth
return getattr(mod, modname).get_auth(sock, dname, host, dno)
File "/usr/lib/python3/dist-packages/Xlib/support/unix_connect.py", line 116, in new_get_auth
au = xauth.Xauthority()
File "/usr/lib/python3/dist-packages/Xlib/xauth.py", line 44, in __init__
raise error.XauthError('~/.Xauthority: %s' % err)
Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/root/.Xauthority'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mvyjt7lg/pyautogui/
@phd "sudo -H pip3 install pyautogui " 给我这个错误
alex@aimarket:/home$ sudo -H pip3 install pyautogui
Collecting pyautogui
Using cached PyAutoGUI-0.9.36.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-efkrhbdk/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/tmp/pip-build-efkrhbdk/pyautogui/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/tmp/pip-build-efkrhbdk/pyautogui/pyautogui/_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
ModuleNotFoundError: No module named 'Xlib'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-efkrhbdk/pyautogui/
PyAutoGUI
在 Unix 上需要 Xlib; the module xauth 尝试打开 ~/.Xauthority
即 /root/.Xauthority
并已加载。看来你是 运行 X Window 在非 root 用户下或根本不是 运行 它。
尝试为用户 运行 X11 安装 PyAutoGUI
。如果您确实需要以 root 身份安装,请通过 运行 sudo -H pip3 install pyautogui
.
$HOME
env var
如果没有任何帮助,请将 XAUTHORITY env var 指向文件:
XAUTHORITY=/home/alex/.Xauthority pip3 install pyautogui
答案:pyautogui
对Ubuntu17.10不起作用,因为pyautogui
需要运行X11,所以你必须进入 Ubuntu 的登录屏幕并单击齿轮图标,在那里你将有两个选项,即 Ubuntu
或 Ubuntu on Xorg
单击 Xorg 上的 Ubuntu ,这将为您提供所需的 X11 功能。
更改后,您可以返回终端并运行 pip3 install pyautogui
,这已为我解决了。
pip install python-xlib
对我有用。
我使用了 pyvirtualdisplay
和 pyautogui
,当我尝试将其打包到 docker 时遇到了同样的错误。
use_xauth = True
参数在创建显示时帮助了我。
display = Display(visible=False, size=(800, 600), use_xauth=True)
别忘了安装 xauth
sudo apt-get install xauth