Facebook时间序列预测模型fbprophet安装一Pystan安装教程

pystan的安装教程

简介

安装Pystan需要安装Python、C++ compiler、Python dependencies,因为Pystan需要C依赖库,采用python自带的环境安装,所需依赖库很难配置完整,所以使用Ansconda来进行安装。

Anaconda下载、安装

链接:https://pan.baidu.com/s/1e3xfh0YOZ8sV2kGFoANJSg
提取码:1j25
Anaconda的安装教程请参阅此博客
安装完成后,打开
在这里插入图片描述

键入

python --version

可以查看python对应的版本型号
在这里插入图片描述

C++ compiler下载、安装(使用Anaconda可不安装)

链接:https://pan.baidu.com/s/196_TJ6CqzQmUQ9Q_Hqxe8Q
提取码:bonb
根据步骤逐步安装即可

安装python依赖库(可新建虚拟环境)

打开win+R,输入cmd打开win系统命令窗口。
创建虚拟环境

conda create -name fbp_env python=3.7

激活虚拟环境

activate fbp_env 

安装MingW-w64编译器

conda install libpython m2w64-toolchain -c msys2

在这里插入图片描述

安装cpthon

conda install numpy cython -c conda-forge

在这里插入图片描述

安装matplotlib scipy pandas

conda install matplotlib scipy pandas -c conda-forge

安装PyStan

conda install pystan -c conda-forge

在这里插入图片描述

安装jupyter

conda install jupyter

安装nb_conda_kernels工具

conda install nb_conda_kernels

打开jupyter选择需要的编译环境

在这里插入图片描述

验证PyStan是否安装成功

import pystan
import numpy as np
ocode = """
data {
    int<lower=1> N;
    real y[N];
}
parameters {
    real mu;
}
model {
    y ~ normal(mu, 1);
}
"""
sm = pystan.StanModel(model_code=ocode)
y2 = np.random.normal(size=20)
np.mean(y2)

op = sm.optimizing(data=dict(y=y2, N=len(y2)))

op

在这里插入图片描述

下一步计划

待完成fbprophet的安装和验证,参见博客

问题总结

一、如安装过程中提示:“无法定位程序输入点 OPENSSL_sk_new_reserve 于动态链接库 D:\Program Files\Anaconda3\Library\bin\libssl-1_1-x64.dll上”
解决方案:
1、将D:\Program Files\Anaconda3\Library\bin里的libssl-1_1-x64.dll重命名。
2、将D:\Program Files\Anaconda3\DLLs下的libssl-1_1-x64.dll文件拷贝到D:\Program Files\Anaconda3\Library\bin里,将原来的文件替换。
二、安装过程网络太慢,可以使用更换源
1、打开win+R,输入cmd打开win系统命令窗口。
2、执行conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
3、执行conda config --set show_channel_urls yes
4、在目录 C:\Users<你的用户名> 下就会生成配置文件.condarc,可查看相应的源配置。
5、将.condarc的内容改为如下:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

参考

【1】fbprophet安装及使用笔记
【2】pystan官网安装教程

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT_ROBOT

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值