【问题标题】:I can't download selenium because of Permissions由于权限,我无法下载 selenium
【发布时间】:2019-01-22 17:00:01
【问题描述】:

我正在尝试安装 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.

【问题讨论】:

  • 它说考虑使用--user 选项你试过了吗?

标签: python bash selenium-chromedriver


【解决方案1】:

建议pip install --user selenium

为了解决这个问题,自制文档建议the following

注意pip install --user 正常的pip install --user 被禁用 用于酿造 Python。这是因为distutils 中的一个错误,因为 Homebrew 写了一个 distutils.cfg 来设置包前缀。

一种可能的解决方法(将可执行脚本放入 ~/Library/Python/&lt;X&gt;.&lt;Y&gt;/bin) 是:

python -m pip install --user --install-option="--prefix=" &lt;package-name&gt;

【讨论】:

  • 太棒了!标记为答案,以便人们知道您的问题已解决@noname
【解决方案2】:

首先,运行:

brew clean all && brew doctor

看起来您使用的是系统 Python 而不是自制软件,因此您可能会受益于:

brew install python

并确保/usr/local/bin$PATH 环境变量中位于/usr/bin 之前。

【讨论】:

    猜你喜欢
    • 2022-07-30
    • 2021-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-17
    • 1970-01-01
    相关资源
    最近更新 更多