【问题标题】:Installing Pandas on MacOs. Permission Error在 MacO 上安装 Pandas。权限错误
【发布时间】:2017-03-11 00:40:32
【问题描述】:

我正在尝试在 Mac 上 pip install pandas。我安装了 python 3.6。

当我在终端中安装 pip 时,出现以下错误:

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, 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/pandas'

【问题讨论】:

  • 这个问题在过去一周内至少被问了 3 次,发帖前请尝试谷歌搜索。

标签: python macos python-3.x pandas pip


【解决方案1】:

您是否可以通过突出显示错误并按 ctrl+k 将错误编辑为格式化的代码块,以便更易于阅读?谢谢。

编辑:另外,我只是查看了一下,底部显示权限被拒绝。尝试以管理员身份重新运行该命令。 IE试试这个命令:

sudo pip install pandas

【讨论】:

  • 对不起
【解决方案2】:

您可能已经注意到,Mac 带有一个内置的 Python,python 2.7。如果您阅读回溯:/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py 它指向 2.7 目录。此目录位于 Library 文件夹中,因此您无权安装它。

但是你声明你也安装了 Python 3.6,所以如果你想安装到那个 indtead。执行pip3 install pandaspython3 -m pip install pandas 这有助于指定python 版本。如果你想在终端运行 python 3.6,输入 python3 而不是 python

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-06
    • 2021-01-28
    • 2015-01-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多