【问题标题】:Selenium can not install due to errorsSelenium 由于错误而无法安装
【发布时间】:2023-03-31 18:56:01
【问题描述】:

我正在尝试安装 Selenium,但遇到了这些错误。我在 Git hub 上查看了一些修复,但没有任何帮助。有没有人认识到这个问题并知道如何解决它?

Jasons-MBP:~ jasonmcgriff$ pip install selenium
Collecting selenium
Downloading selenium-2.48.0-py2-none-any.whl (872kB)
100% |████████████████████████████████| 872kB 421kB/s 
Installing collected packages: selenium
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 310, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os. py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-   packages/selenium'enter code here

【问题讨论】:

  • Permission denied,很明显:您无权访问pip 的安装位置。尝试以提升的状态运行pipsudo 模式)。例如:sudo pip install selenium
  • 感谢您的帮助。它现在正在工作。
  • 这不是编程问题...这是 Selenium 安装的支持问题。
  • @JeffC 这个网站的做法是只允许纯编程问题吗?不允许对周围和编程使用的工具提出问题?
  • @usandfriends 我不太确定您的回答(或评论)是否正确。我有这个错误,可以在其他库上使用 pip。该错误是针对特定文件和 Selenium 的独特问题。 Jason John,尽管我们将大部分开发时间都花在了这些问题上,但他们不希望将它们发布在这里。这些天很难发布一个问题而不被否决,因为有一百万个意见该网站应该如何工作......我投了赞成票,所以你没有-1代表一个经过深思熟虑的问题。

标签: selenium command-line terminal installation


【解决方案1】:

如果您查看您发布的最后一个错误...

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site- packages/selenium'

/selenium*下已经有东西了

我在这条路径上遇到了同样的问题...

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/selenium-2.42.1-py2.7.egg-info'

只需像这样删除...

sudo rm -r /Library/Python/2.7/site-packages/selenium-2.42.1-py2.7.egg-info

然后重新安装它工作并更新到最新版本。我用过这个...

pip install --upgrade selenium

请注意,我没有使用 sudo 或尝试以 root 身份运行。

【讨论】:

    猜你喜欢
    • 2011-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-27
    • 2021-11-16
    • 2021-02-09
    相关资源
    最近更新 更多