2015-06-19 37 views
6

我想在使用iPython的同時導入熊貓。我的總體目標是使用XLwings。如何解決在Windows上使用iPython Notebook的熊貓導入錯誤?

我在Windows 7上,並使用Anaconda來安裝Python,熊貓和所有的依賴關係。

這裏是我的代碼:

from pandas import DataFrame 

其中給出:

ImportError        Traceback (most recent call last) 
<ipython-input-7-26dfcabfb474> in <module>() 
----> 1 from pandas import DataFrame 

C:\Users\Accounting\Anaconda\lib\site-packages\pandas\__init__.py in <module>() 
    11      "pandas from the source directory, you may need to run " 
    12      "'python setup.py build_ext --inplace' to build the C " 
---> 13      "extensions first.".format(module)) 
    14 
    15 from datetime import datetime 

ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first. 

任何人都可以在Windows中IPython中使用Python /大熊貓的經驗幫助我瞭解如何解決這個問題?

具體我在哪裏運行「python setup.py build_ext --inplace」?

謝謝!

+2

你沒有。舊版本(conda)中存在一個錯誤,如果您在更新熊貓期間更新了它,但它沒有正確更新。嘗試關閉所有的Python進程,然後''conda刪除熊貓; conda安裝pandas'' – Jeff

+0

Doh!這工作完美!謝謝傑夫。 –

回答

6

張貼由傑夫的評論:

有在時如果正在使用它沒有正確更新您已經更新大熊貓舊版本(的暢達)的錯誤。請嘗試關閉所有的Python程序,然後

conda remove pandas 

conda install pandas 
+2

請注意,這是僅在windows – Jeff

+0

我在Ubuntu 14.04中遇到這種情況,並關閉Python進程,'conda remove pandas',然後重新安裝似乎並沒有解決它。重新安裝後(** with conda **),我得到這個「ImportError:C擴展名:沒有名爲builtins的模塊沒有內置。如果你想從源目錄導入熊貓,你可能需要運行'python setup.py build_ext - 'inplace'首先構建C擴展。「 – ely

0

我發現在安裝包(由克里斯托夫Gohlke最),有時你必須使用「PIP安裝.whl的名稱」(以正確的路徑來包裝),最初加入「C:/ miscutilities」爲環境變量PATH,如果它不從Anaconda - > Lib - > site-packages安裝。然後我使用conda的其他一些軟件包。