2016-04-13 51 views
1

我的熊貓包沒有被導入。 當我嘗試檢查,如果我有使用命令大熊貓Python-2.7模塊肯定安裝時沒有被導入

python -c "import pandas" 

它顯示了一些奇怪的錯誤,如

<module 'numpy' from 'numpy.pyc'> 
'module' object has no attribute 'dtype' 
Traceback (most recent call last): 
File "<string>", line 1, in <module> 
File "/usr/lib/python2.7/dist-packages/pandas/__init__.py", line 6, in <module> 
from . import hashtable, tslib, lib 
File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:21706) 
AttributeError: 'module' object has no attribute 'dtype' 
+0

你嘗試過'導入numpy'嗎? – Zach

+0

是的,我做了@Zach –

+0

很高興看到你解決了它! – Zach

回答

2

您有一個名爲numpy.py一個本地文件是正在進口的全局,而不是安裝NumPy項目:

<module 'numpy' from 'numpy.pyc'> 

刪除或重命名該文件並刪除關聯它旁邊有一個numpy.pyc文件。您的本地文件沒有名稱dtype,只有numpy安裝在您的site-packages中,但是當您每次首次找到您的文件時無法加載。

+0

謝謝@馬丁皮特斯,剛解決它 –