系统: linux redhat
环境: python2.7
tsfresh官网:http://tsfresh.readthedocs.io/en/latest/text/quick_start.html
tsfresh本身官网提供的安装过程比较简单: pip install tsfresh即可。但是安装过程很耗时且安装过程中依赖的其他的python组件,一旦安装报错则只能重新安装,下面是自己的采坑之旅。
1、yum install python-devel 安装 python-devel。 该组件是安装numpy时依赖的组件
2、yum install gcc gcc+ gcc-c++, 安装gcc编译组件。 numpy+SciPy需要依赖这三个组件,已安装可以跳过
3、yum install blas-devel lapack-devel, SciPy组件依赖这两个开发组件。
4、pip install numpy , 安装numpy
5、pip install SciPy , 安装SciPy
6、pip install -U setuptools 升级pip版本,否则tsfresh安装过程中会报错,提示升级版本
7、pip install 出现UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 73: ordinal not i错误信息时
解决办法:
1)在/usr/local/lib/python2.7/site-packages目录下创建 sitecustomize.py
2)文件中输入:
import sys
sys.setdefaultencoding('utf-8')
3)重新执行pip install 命令
8、pip install tsfresh, 安装过程中如果出现 read time out 等错误时,重新执行命令,下载包安装即可。
下面为安装过程中遇到问题总结:
python2.7 安装问题
1、RuntimeError: Broken toolchain: cannot link a simple C program
解决办法:sudo pip install -U setuptools
2、ImportError: No module named numpy.distutils.misc_util
解决办法:pip install numpy
3、执行pip install numpy 时仍然报 RuntimeError: Broken toolchain: cannot link a simple C program
解决办法:
1) 查看gcc是否安装: rpm -qa | grep gcc, 未安装则安装gcc ,安装命令 yum install gcc
4、执行 pip install numpy 报: SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
解决办法:安装 python-devel , yum install python-devel
5、ImportError: Scientific Python (SciPy) is not installed.
解决方案:sudo pip install SciPy
6、安装 SciPy时报 numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
sudo yum install blas-devel lapack-devel
7、pip install 出现UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 73: ordinal not i
解决办法:
1)在/usr/local/lib/python2.7/site-packages目录下创建 sitecustomize.py
2)文件中输入:
import sys
sys.setdefaultencoding('utf-8')
3)重新执行pip install 命令
9、/bin/bash: g++: command not found
解决方案: 查看是否安装gcc, rpm -qa | grep gcc. rpm -qa | grep gcc+ . rpm -qa | grep gcc-c++
没有进行安装,安装了则进行升级。
yum -y update gcc
yum -y install gcc+ gcc-c++
10、RuntimeError: Your setuptools version is too old (<12). Use `pip install -U setuptools` to upgrade.
pip install -U setuptools