Prophet Python 和 R 版本安装配置指南
Prophet 是 Facebook 开发的一款强大的时间序列预测工具,能够处理具有多重季节性的线性或非线性增长数据。本文将为您提供完整的 Prophet 安装配置指南,涵盖 Python 和 R 两个版本的详细安装步骤和配置方法。
Python 版本安装
使用 pip 安装(推荐)
最简单的安装方式是通过 PyPI 使用 pip 命令:
python -m pip install prophet
对于 Python 3.7 及以上版本,这是最快捷的安装方式。安装完成后,您可以通过以下代码验证安装是否成功:
from prophet import Prophet
print("Prophet 安装成功!")
Anaconda 环境安装
如果您使用 Anaconda,可以通过 conda-forge 渠道安装:
conda install -c conda-forge prophet
开发版本安装
如需获取最新开发版本,可以克隆仓库并手动编译:
git clone https://github.com/facebook/prophet
cd prophet/python
python -m pip install -e .
R 版本安装
CRAN 稳定版安装
R 用户可以通过 CRAN 安装稳定版本:
install.packages('prophet')
最新版本安装
要获取最新功能和修复,建议安装 GitHub 上的最新发布版本:
install.packages('remotes')
remotes::install_github('facebook/prophet@*release', subdir = 'R')
Windows 系统特殊配置
Windows 用户需要额外安装 Rtools:
- 下载并安装 Rtools
- 配置系统环境变量
- 重启 R 会话后安装 prophet
环境配置与依赖管理
Python 依赖检查
Prophet 依赖于以下 Python 包:
- pandas >= 1.0.4

