python 安裝pandas包時出現ImportError: Building pandas requires cython

pandas有強大的數據處理能力,在本機安裝(Windows),沒有遇到什麼問題,但是在服務器上安裝時(centos),使用easy_install的方式,下載及其緩慢,於是就將本地把包下好,然後上傳到服務器上,解壓後,然後使用命令:
sudo ./../python setup.py install
提示如下錯誤

  File "./setup.py", line 131, in build_extensions
    raise ImportError('Building pandas requires cython')
ImportError: Building pandas requires cython

檢查Cython的安裝情況,發現也是安裝了的

sudo ./easy_install Cython
Searching for Cython
Best match: Cython 0.19
Adding Cython 0.19 to easy-install.pth file

Using /home/q/python27/lib/python2.7/site-packages
Processing dependencies for Cython
Finished processing dependencies for Cython

google了一下,幾乎沒找到相關的解決方案。於是打開setup.py,看了拋出異常的路徑:

class build_ext(_build_ext):
128     def build_extensions(self):
129 
130         if not cython:
131             **raise ImportError('Building pandas requires cython')**
132 

檢查下cython的值:

 32 min_cython_ver = '0.19.1'
 33 try:
 34     import Cython
 35     ver = Cython.__version__
 36     _CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
 37 except ImportError:
 38     _CYTHON_INSTALLED = False

明顯,這是因爲我的cython版本過低導致,

>>> Cython.__version__
'0.19'

於是重新升級了cython的版本,問題解決了。

發佈了36 篇原創文章 · 獲贊 18 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章