python - 由于权限,我无法下载 selenium
问题描述
我正在尝试安装 selenium,但它说我不能这样做,因为权限。顺便说一下,我在 MacOS Mojave 10.14 上这样做
我刚刚输入''brew reinstall selenium-server-standalone''然后它失败了权限的原因,你可以在代码部分看到。
==> Reinstalling selenium-server-standalone
==> Downloading https://selenium-release.storage.googleapis.com/3.141/selenium-s
Already downloaded: /Users/temirhanzakirov/Library/Caches/Homebrew/downloads/25a539ffe0543bae17e9cc5a70f6f187f973eb016e93696e667c6e4f6bbbf39a--selenium-server-standalone-3.141.59.jar
==> Caveats
To have launchd start selenium-server-standalone now and restart at login:
brew services start selenium-server-standalone
Or, if you don't want/need a background service you can just run:
selenium-server -port 4444
==> Summary
/usr/local/Cellar/selenium-server-standalone/3.141.59: 5 files, 10.2MB, built in 2 seconds
MacBook-Pro-Temirhan:google-activity-gen temirhanzakirov$ python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
from selenium import webdriver
ImportError: No module named selenium
MacBook-Pro-Temirhan:google-activity-gen temirhanzakirov$ pip install selenium
Collecting selenium
Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Collecting urllib3 (from selenium)
Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl
Installing collected packages: urllib3, selenium
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/urllib3-1.24.1.dist-info'
Consider using the `--user` option or check the permissions.
解决方案
第一次运行:
brew clean all && brew doctor
看起来您正在使用系统 Python 而不是自制软件,因此它可能会使您受益:
brew install python
并确保它/usr/local/bin
在/usr/bin
您的$PATH
环境变量中。
推荐阅读
- yosys - 使用 yosys 简化组合逻辑
- javascript - 无法从php输入数组到javascript
- css - 为不同的移动断点处理和分组 CSS 属性
- python - VS Code:无法在 Python Interactive 上加载 anaconda 环境
- sql - 从 SQL 中的 mm/yy 中减去一个月
- java - AWS - 使用 @connections websocket 回调 url 从后端发送响应(单向) - API Gateway websocket 协议
- xslt - 无法使用 unparsed-text() 读取 xslt 中的 .properties 文件
- mysql - Loopback Mysql 连接器自定义查询结果到字段值
- python - 区域中的定点并得到一个错误 ValueError:一个系列的真值是不明确的。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()
- python-3.x - 如何在python中制作网络监听器?