[英]pip install selenium permission error
我正在嘗試使用默認的python即/usr/bin/python
在Mac上安裝Selenium 3,但是當我嘗試使用以下命令安裝https://pypi.org/project/selenium/時
pip install selenium
我遇到錯誤,使用緩存收集硒
https://files.pythonhosted.org/packages/41/c6/78a9a0d0150dbf43095c6f422fdf6f948e18453c5ebbf92384175b372ca2/selenium-3.13.0-py2.py3-none-any.whl
Installing collected packages: selenium
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/selenium'
Consider using the `--user` option or check the permissions.
如果我使用--user
作為pip install --user selenium
則可以運行,但是當我使用代碼運行測試時
driver = webdriver.Safari(executable_path="/Users/Desktop/selenium-server-standalone-3.13.0.jar")
我得到錯誤
WebDriverException: Message: 'selenium-server-standalone-3.13.0.jar' executable may have wrong permissions.
為什么我出錯了,並且有沒有--user
和sudo
安裝方法,因為即使使用這些選項,它也不起作用。
您通過使用--user
解決了第一個問題-第二個問題是另一個問題。
此行webdriver.Safari(executable_path=...)
指向錯誤的路徑-您應該將其指向safari 10隨附的savaridriver
可執行文件的任何savaridriver
,而不是.jar
文件。
像這樣:
driver = webdriver.Safari(executable_path='/Applications/Safari.app/Contents/MacOS/safaridriver')
只需在Mac中檢查路徑,然后找出您的safaridriver
在哪里。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.