0

尝试使用 pip 安装 praw 时遇到一些异常。以下是我收到的错误消息:

MacBook:usr name_r$ pip install praw
Downloading/unpacking praw
  Downloading praw-2.1.20-py2.py3-none-any.whl (74kB): 74kB downloaded
Downloading/unpacking requests>=2.3.0 (from praw)
  Downloading requests-2.5.1-py2.py3-none-any.whl (464kB): 464kB downloaded
Downloading/unpacking update-checker>=0.11 (from praw)
  Downloading update_checker-0.11-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /Library/Python/2.7/site-packages/six-1.8.0-py2.7.egg (from praw)
Installing collected packages: praw, requests, update-checker
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
    pycompile=self.pycompile,
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
    os.makedirs(destdir)
  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/praw'

Storing debug log for failure in /var/folders/qz/q26gj5zx62d3d206hdnn_rwm0000gn/T/tmp_wCuvN

有人可以告诉我这里发生了什么吗?我需要以某种方式更新 Python 还是 pip 有问题?

我怎样才能让它正确安装 praw?

4

1 回答 1

0
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/praw'

看来你是在Mac上运行,需要换成root用户安装,否则你没有文件夹的写权限。“sudo -s”将更改为root。

于 2015-01-30T04:25:57.450 回答