python 3 + statsmodels?

use*_*301 14 python-3.x statsmodels

如果我这样做,sudo pip3 install statsmodels我会收到错误.我粘贴了下面控制台输出的结尾.我看到一个numpy 1.7警告,但如果我这样做pip3 freeze | grep numpy,我看到我正在使用numpy==1.8.1.

这是输出.有任何想法吗?

/usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

 #warning "Using deprecated NumPy API, disable it by " \

  ^

statsmodels/tsa/kalmanf/kalman_loglike.c: In function ‘__Pyx_TraceSetupAndCall’:

statsmodels/tsa/kalmanf/kalman_loglike.c:7021:17: error: ‘PyFrameObject’ has no member named ‘f_tstate’

         (*frame)->f_tstate = PyThreadState_GET();

                 ^

In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,

                 from /usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h:4,

                 from statsmodels/tsa/kalmanf/kalman_loglike.c:257:

statsmodels/tsa/kalmanf/kalman_loglike.c: At top level:

/usr/lib/python3/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1: warning: ‘_import_array’ defined but not used [-Wunused-function]

 _import_array(void)

 ^

In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ufuncobject.h:327:0,

                 from statsmodels/tsa/kalmanf/kalman_loglike.c:258:

/usr/lib/python3/dist-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]

 _import_umath(void)

 ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/statsmodels/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ukof84o0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/statsmodels
Storing debug log for failure in /home/kurt/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

Nat*_*son 15

据我所知,即使安装了Cython 0.20.1(最新版本),statsmodels 0.5.0也无法与Python 3.4一起使用.然而,最新的主安装很好,所以如果您愿意使用未发布的版本,这里有一种方法:

git clone https://github.com/statsmodels/statsmodels
cd statsmodels
pip install .
Run Code Online (Sandbox Code Playgroud)

更新:使用最新版本不需要这样做 - 请参阅下面的Rasmus Larsen的评论.

  • 您也可以尝试`pip3 install git + git:// github.com/statsmodels/statsmodels`,它的好处是您不需要克隆存储库.然后升级到最新版本,你可以输入:`pip3 install --upgrade git + git:// github.com/statsmodels/statsmodels` (6认同)
  • 对于未来的读者,使用支持python 3.4的statsmodels 0.6.0:http://statsmodels.sourceforge.net/binaries/ (5认同)