天天看點

scipy.optimize ImportError: cannot import name '_zeta'

最近開發同僚讓我裝幾個包,scipy、gensim、theano、sklearn.....幾個包裝完後,發現導入報錯,具體如下:

from ._ufuncs import (ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma,

ImportError: cannot import name '_zeta'

通過某度搜了好久愣是沒發現解決辦法,後來直接出去,用Google搜尋,直接提示scipy版本問題,更新即可,

Sounds like you have an old version of <code>special._ufuncs</code>--the function <code>zeta</code> in there was renamed to<code>_zeta</code> somewhat recently. What happens if you completely uninstall SciPy and then reinstall a fresh version? (Also, what version of SciPy are you using?)

這裡真的不得不吐槽一把....

[root@localhost~]# pip uninstall scipy

[root@localhost~]# pip install -U scipy

後面的安裝過程大概需要10分鐘左右,最終結果為:

  Could not find .egg-info directory in install record for scipy from https://pypi.python.org/packages/22/41/b1538a75309ae4913cdbbdc8d1cc54cae6d37981d2759532c1aa37a41121/scipy-0.18.1.tar.gz#md5=5fb5fb7ccb113ab3a039702b6c2f3327 in /usr/local/lib/python2.7/site-packages

Successfully installed scipy

Cleaning up...

[root@localhost~]# python

Python 2.7.10 (default, Dec 22 2016, 14:45:25) 

[GCC 4.8.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

&gt;&gt;&gt; import scipy

&gt;&gt;&gt; import gensim

&gt;&gt;&gt; import theano

&gt;&gt;&gt; import sklearn

&gt;&gt;&gt; exit

Use exit() or Ctrl-D (i.e. EOF) to exit

&gt;&gt;&gt; exit()

[root@localhost ~]#

      本文轉自027ryan  51CTO部落格,原文連結:http://blog.51cto.com/ucode/1893119,如需轉載請自行聯系原作者