EasyProcessCheckInstalledError:cmd = ['Xephyr',' - help']

时间:2018-01-19 09:23:51

标签: python cmd pyvirtualdisplay

我在Windows 7 SP1上使用Python 2.7并且我已经正确安装了pyvirtualdisplay和Selenium但是当我运行此脚本时:

from pyvirtualdisplay import Display
display = Display(visible=1, size=(800, 600))
display.start()

我收到此错误:

Traceback (most recent call last):
  File "C:\Python27\hoho - Copie.py", line 2, in <module>
    display = Display(visible=1, size=(800, 600))
  File "build\bdist.win32\egg\pyvirtualdisplay\display.py", line 34, in __init__
    self._obj = self.display_class(
  File "build\bdist.win32\egg\pyvirtualdisplay\display.py", line 52, in display_class
    cls.check_installed()
  File "build\bdist.win32\egg\pyvirtualdisplay\xephyr.py", line 30, in check_installed
    ubuntu_package=PACKAGE).check_installed()
  File "build\bdist.win32\egg\easyprocess\__init__.py", line 180, in check_installed
    raise EasyProcessCheckInstalledError(self)
EasyProcessCheckInstalledError: cmd=['Xephyr', '-help']
OSError=[Error 2] No such file or directory
Program install error! 
>>> 

1 个答案:

答案 0 :(得分:-1)

我找到了解决此问题的方法,下载chromedriver.exe并将其复制到路径文件夹中,然后更改:

from pyvirtualdisplay import Display
display = Display(visible=1, size=(800, 600))
display.start()

from selenium import webdriver
chrome_path = r"C:\Python27\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)

:)