在官网上下载pymc3.8的镜像文件后用pip install命令进行安装,安装后调用pymc3出现如下警告:
>>> import pymc3WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`Warning (from warnings module):File \"D:\\anaconda3\\lib\\site-packages\\theano\\configdefaults.py\", line 560warnings.warn(\"DeprecationWarning: there is no c++ compiler.\"UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatoryWARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
原因在于电脑缺少c++编译环境
很明显,我们需要在cmd中通过命令conda install m2w64-toolchain进行相关的编译程序的安装(大概100多M)
也可以不安装c++编译环境,可以把Theano的标志cxx设置为空,来消除以上警告
虽然安装时间有点长,但安装c++环境相关程序后,它们会把pymc3重新根据你的CPU、GPU编译优化一遍,这个好处还是挺大的(相对来说机器学习也比较吃硬件叭)