alexer / python-xlib

Unofficial git mirror of the python-xlib subversion repository
GNU General Public License v2.0
10 stars 2 forks source link

a error when i install pyautogui that indepened python-lib #2

Open Linkding opened 8 years ago

Linkding commented 8 years ago
issu:install pyautogui fail

result: [root@lin PyAutoGUI-0.9.33]# python setup.py install Traceback (most recent call last): File "setup.py", line 6, in version=import('pyautogui').version, File "/usr/PyAutoGUI-0.9.33/pyautogui/init.py", line 114, in from . import _pyautogui_x11 as platformModule File "/usr/PyAutoGUI-0.9.33/pyautogui/_pyautogui_x11.py", line 153, in _display = Display(None) # TODO - Display() can have other values passed to it. Implement that later. File "/usr/local/lib/python2.7/site-packages/Xlib/display.py", line 83, in init self.display = _BaseDisplay(display) File "/usr/local/lib/python2.7/site-packages/Xlib/display.py", line 65, in init apply(protocol.display.Display.init, (self, ) + args, keys) File "/usr/local/lib/python2.7/site-packages/Xlib/protocol/display.py", line 44, in init name, host, displayno, screenno = connect.get_display(display) File "/usr/local/lib/python2.7/site-packages/Xlib/support/connect.py", line 65, in get_display return mod.get_display(display) File "/usr/local/lib/python2.7/site-packages/Xlib/support/unix_connect.py", line 59, in get_display raise error.DisplayNameError(display) Xlib.error.DisplayNameError: Bad display name ""

how to fix it.

qiujieqiong commented 8 years ago

python2

sudo apt-get install python-pip sudo pip install pyautogui pip show pyautogui

python3

sudo apt-get install python3-pip sudo pip3 install pyautogui pip3 show pyautogui

ranarieliU commented 8 years ago

I'm having same issue on python3 and this doesn't work for me. Any suggestions?

qiujieqiong commented 8 years ago

check if exist ".Xauthority" in your root dir, only /home/user exist ".Xauthority", so change your authority to user : su - user

studioj commented 7 years ago

I had the same problem when installing pyautogui via SSH. When i opened the commandline tool on screen of the device itself and ran pip install pyautogui everything worked like a charm...

qiujieqiong commented 7 years ago

You need 'export DISPLAY=:0' before 'pip install pyautogui ' if you install pyautogui via SSH.

Alexhha commented 7 years ago

Or you can use xvfb-run pip install pyautogui