【发布时间】:2019-01-01 13:42:13
【问题描述】:
我正在尝试使用默认 python 在 mac 上安装 selenium 3,即/usr/bin/python
但是当我尝试使用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 的情况下安装,因为即使使用这些选项也无法正常工作。
【问题讨论】:
-
Sudo 是 Linux。还有,你为什么不想用呢?
标签: python selenium selenium-webdriver pip selenium3