使用Pymc3遇到的Error

1、pymc3安装

     使用Anaconda3默认环境安装

           conda install pymc3

           pip install -U h5py

     linux安装pymc3:

           sudo apt-get install xxx

           头文件:#!/usr/bin/env python

     Linux安装pip3:sudo apt-get install python3-pip

                               sudo apt-get install vim, jupyter, pymc3

 

2、matplotlib在绘图时要使用中文的方法

      插入以下代码:

      plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签

      plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号

 

3、pymc3程序中报‘CVM’错误

      pip install -U pymc3

 

4、pymc3程序中的userwarning

      UserWarning: The 'normed' kwarg is deprecated, and has been replaced by the 'density' kwarg.

      warnings.warn("The 'normed' kwarg is deprecated, and has been ")

      解决方案:将程序函数中 'normed' 改为'density'

 

5、pymc3程序的RuntimeError

     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.

        解决方案:在程序开头添加

               from multiprocessing import freeze_support

               if __name__ == '__main__':

                              代码

                       freeze_support()

 

6、pymc3程序中的MemoryError

      将’ElemwiseCategorical‘更改为‘CategoricalGibbsMetropolis’

           使用Pymc3遇到的Error_第1张图片

 

 

7、pymc3的方法错误

      ’pm.df_summary‘改为‘pm.summary'

 

8、linux下报_tkinter.TclError

      _tkinter.TclError: no display name and no $DISPLAY environment variable

      添加代码:

      import matplotlib matplotlib.use('Agg')

 

9、Linux系统pymc3中的RuntimeWarning

      RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88

      return f(*args, **kwds)

      解决方案:

              from warnings import filterwarnings

              filterwarnings("ignore", message=r'numpy.dtype')

 

10、linux pip3 importerror: cannot import name 'main'

        sudo python3 -m pip uninstall pip

        sudo apt install python3-pip --reinstall

你可能感兴趣的:(python)