Python 在mac上安装praw

Python 在mac上安装praw,python,macos,pip,reddit,praw,Python,Macos,Pip,Reddit,Praw,我已经安装了自制软件和pip。当我运行$pip install praw时,会出现以下情况: dhcp-215-185:~ my_name$ pip install praw Downloading/unpacking praw Downloading praw-2.1.16-py2.py3-none-any.whl (70kB): 70kB downloaded Downloading/unpacking update-checker>=0.10 (from praw) Down

我已经安装了自制软件和pip。当我运行$pip install praw时,会出现以下情况:

dhcp-215-185:~ my_name$ pip install praw
Downloading/unpacking praw
  Downloading praw-2.1.16-py2.py3-none-any.whl (70kB): 70kB downloaded
Downloading/unpacking update-checker>=0.10 (from praw)
  Downloading update_checker-0.10-py2.py3-none-any.whl
Downloading/unpacking requests>=1.2.0 (from praw)
  Downloading requests-2.2.1-py2.py3-none-any.whl (625kB): 625kB downloaded
Downloading/unpacking six>=1.4 (from praw)
  Downloading six-1.6.1-py2.py3-none-any.whl
Installing collected packages: praw, update-checker, requests, six
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.5.5-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.5-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.5-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.5-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.5-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.5-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.5-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 /Users/my_name/Library/Logs/pip.log
dhcp-215-185:~ my_name$ 

有人有办法吗?安装它真是一件让人头疼的事。非常感谢

一个快速解决方法是使用
sudo-pip-install-praw
命令将praw安装为超级用户。但是,不建议这样做,因为这可能会在以后的更新和向上扩展应用程序等方面造成问题。相反,有人建议您和
pip在其中安装praw


如果您确信您正在构建的应用程序不会变得太大,那么使用
sudo

安装praw可能是可以的。我遇到了与您相同的错误,我在中找到了答案。我使用自制软件安装pip,我使用的是Python 3.x而不是OSX附带的2.7x,这意味着我需要使用pip3而不是pip。它马上就起作用了


我希望这有帮助

看起来您正在运行系统
pip
(在
/usr/bin/pip
中)。如果您是通过自制软件安装的,请将
$PATH
设置为运行
/usr/local/bin/pip
。@mipadi谢谢!对不起,我是新手。我该怎么设置呢?再次感谢你的帮助