在windows下安装selenium 反复安装了几次,都报这个错误:
File “c:\users\jibingchuan\appdata\local\programs\python\python36-32\lib\conte
xtlib.py”, line 99, in __exit__
self.gen.throw(type, value, traceback)
File “c:\users\jibingchuan\appdata\local\programs\python\python36-32\lib\site-
packages\pip\_vendor\urllib3\response.py”, line 307, in _error_catcher
raise ReadTimeoutError(self._pool, None, ‘Read timed out.’)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=’files
.pythonhosted.org’, port=443): Read timed out.
解决也简单,延长超时时间就可以解决:
pip3 –default-timeout=1000 install selenium
安装完上面的还没完,运行时有报错:
ERROR:install_util.cc(597)] Unable to readregistry value HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmen
tToken for writing result=2
然后在注册表里加一个值就可以了。
新建一个字符串值,名称是:MachineLevelUserCloudPolicyEnrollmentToken
网上也有这么修复的,可以参考:
1 2 3 4 5 6 7 8 |
I fixed it by replacing: chrome_options = webdriver.ChromeOptions() For: from selenium.webdriver.chrome.options import Options chrome_options = Options() |