首页 > 解决方案 > 如何使用 python 3.x 而不是 python 2.7.9 安装 praw

问题描述

我正在尝试安装 praw 以允许我制作 Reddit 机器人。我已经在 Windows 机器上实现了这一点,并成功制作了一个简单的机器人,但是在尝试在我的 mac 上安装 praw 时遇到了持续错误。

当我进入pip install praw终端时,它说:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting praw
  Using cached https://files.pythonhosted.org/packages/f6/df/b42c0a3b86a43a62a46e5b2f07930230ac7719624800a2052218993fb767/praw-6.4.0-py2.py3-none-any.whl
ERROR: Package 'praw' requires a different Python: 2.7.9 not in '>=3.4'

我的 Python 3 版本应该没问题:

$ python3 --version
Python 3.4.3

但我似乎无法使用 Python 3 安装它,它只想使用 Python 2 安装。

在 Windows 上,我可以简单地安装 Python 3,然后轻松安装 praw;但 MacOS 似乎使用 Python 2.7 作为某种默认值——我不确定如何覆盖。

标签: pythonpraw

解决方案


使用:python3 -m pip install praw


推荐阅读