1.安装版本。
安装pyMC3==3.11.0, 一定要装theano-pymc,而不是theano
2.AttributeError: module 'numpy' has no attribute 'bool'.
将numpy降级到:pip install numpy==1.23.1
3.AttributeError: module 'numpy.distutils.__config__' has no attribute 'blas_opt_info'
将numpy降级到:pip install numpy==1.21.6
4.AttributeError: 'TheanoConfigParser' object has no attribute 'gcc__cxxflags'
删除卸载所有theano, pip install theano-pymc==1.1.0
5.ImportError: DLL load failed while importing mf6917bb35eaa79d4a20c20b9dc13c0435e656b1bdb67265fed3d06258ff43ef9: 找不到指定的模块。
降级theano-pymc,pip install theano-pymc==1.1.2
降级pymc3,pip install pymc3==3.11.2
6. RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
加main函数,在main中调用:
if __name__=='__main__': with pm.Model() as model: # 定义未知参数 A1 = pm.Uniform('A1', lower=0, upper=2) f1 = pm.Uniform('f1', lower=0, upper=0.2) # 定义观测数据分布 y = A1 * np.sin(2 * np.pi * f1 * t) y_obs_zero_mean = y_obs - np.mean(y_obs) y_obs_std = np.std(y_obs_zero_mean) likelihood = pm.Normal('y', mu=y, sigma=np.atleast_2d(y_obs_std).T, observed=y_obs_zero_mean) # 开始采样 trace = pm.sample(1000, tune=1000)
7. <frozen importlib._bootstrap>:219: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject
升级scipy pip install --upgrade scipy --user
8.ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。
pip install --upgrade scipy --user
9. az.summary(trace)不显示结果
10. AttributeError: module 'arviz' has no attribute 'from_pymc3'
降低arviz的版本:pip install arviz==0.12