环境配置:
Ubantu系统
Python版本:3.7
Anconda创建虚拟环境
时间序列包fbprophet安装
1、创建虚拟环境并激活
conda create -n yourname python=3.7
activate yourname
2、安装C++编译器
方法1、conda install libpython m2w64-toolchain -c msys2直接使用该命令安装
方法2、在ubuntu中安装c++:在终端输入sudo apt-get install g++
方法3、centos安装c++:yum -y install gcc-c++
测试g++是否安装成功:
方法1、终端输入g++ --version
方法2、在终端输入 touch helloword.cpp、用ls查看是否创建成功(存在helloword.cpp文件)
在终端输入:vim helloword.cpp 编辑helloword.cpp文件
#include
using namespace std;
int main()
{
cout<<“Hello World!\n”;
return 0;
}
输入命令:g++ test.cpp -o tests
./tests
3、安装依赖库
conda install numpy cython -c conda-forge
conda install matplotlib scipy pandas -c conda-forge
4、安装pystan
conda install pystan -c conda-forge
5、安装fbprophet
conda install fbprophet -c conda-forge
6、安装plotly模块
conda install plotly -y
测试安装是否成功:python环境下
方法1、from fbprophet import Prophet
2、import fbprophet as fp
tips:
如果Collecting package metadata (current_repodata.json):时间长,请耐心等待,如出现长时间没反应或下文2所示错误,多次尝试安装命令
可能出现的错误:
1、TypeError: This is a python-holidays entity loader class. For entity inheritance purposes please import a class you want to derive from directly: e.g., from holidays.countries import Entity
or from holidays.financial import Entity
解决方法:pip uninstall holidays
pip install holidays==0.17.2
2、解决方法:多次尝试
错误:Collecting package metadata (repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://conda.anaconda.org/conda-forge/linux-64/repodata.json
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https//conda.anaconda.org/conda-forge/linux-64
3、解决方法:
(1)find / -name libtiff.so 找到这个文件的位置如/root/miniconda3/envs/fb3.7/lib/libtiff.so
(2)建立软连接sudo ln -s /root/miniconda3/envs/fb3.7/lib/libtiff.so /root/miniconda3/envs/fb3.7/lib/libtiff.so.5
缺少连接
问题:ImportError: libtiff.so.5: cannot open shared object file: No such file or directory
4、解决方法:pip install pystan2.19.1.1
问题:pip install pystan2.19.1.1
5、解决方法:pip install backports.zoneinfo==0.2.1
问题:from backports.zoneinfo import ZoneInfo # type: ignore[no-redef]
ModuleNotFoundError: No module named ‘backports’