首先跟着各个方法安装,都不行,导入pymc3包时,就会报各种错;最后找了好几个博客跟着修改,最终才把pymc3包安装上了,也能导入进去了。
重新整理下安装步骤:
1、下载安装Anaconda3:
参考该博主:史上最全最详细的Anaconda安装教程_OSurer的博客-CSDN博客
2、安装Pymc模块包:
参考该博主的总结部分:
去PyMC官网下载tar.gz或whl文件,然后安装;参考的博主介绍的很详细;
PyMC库安装中遇到的问题_安装pymc3失败_半夏不忘的博客-CSDN博客
3、在pycharm里面导包,试运行:
运行的例子参考该博主:PyMC3安装以及Hello Project_笨牛慢耕的博客-CSDN博客
import numpy as np
import pymc3 as pm
import scipy.stats as stats
from matplotlib import pyplot as plt
from IPython.core.pylabtools import figsize
#import theano.tensor as tt # Unused. It is OK to comment out it.
# Observed data generation
np.random.seed(123)
trials = 20
theta_gt = 0.35 # unknown value in a real experiment. 'gt' means ground-truth
data = stats.bernoulli.rvs(p=theta_gt, size=trials)
print(data)
刚运行就报错:
ModuleNotFoundError: No module named 'pymc3'
Using NumPy C-API based implementation for BLAS functions
4、解决报错问题:
参考该博主解决上面报错的两个问题:
【无标题】导入pymc3包:import pymc3 as pm时出现错误解决思路_no module named 'pymc3-CSDN博客
报错一:No module named 'pymc3'
(1)重点是:在Anaconda3的Python路径下安装pymc3包: pip install pymc3
(2)安装好后,再次导入,运行
报错一:Using NumPy C-API based implementation for BLAS functions
参考上面博主的解决方法。
参考博主来源:
安装Anaconda:史上最全最详细的Anaconda安装教程_OSurer的博客-CSDN博客
安装pymc3包:https://blog.csdn.net/weixin_45744256/article/details/128500286
pymc官网:pymc · PyPI
示例参考:https://blog.csdn.net/chenxy_bwave/article/details/120493435
报错解决:https://blog.csdn.net/weixin_51339777/article/details/126252060