2017-04-17 159 views
0

我的熊貓有問題。首先,我嘗試在CD C:\ Python27 \ Scrips ...上輕鬆安裝。 easy_install.exe numpy,easy_install.exe pandas但只有numpy工作,熊貓沒有,所以我用點子來安裝。它對兩者都有效。但回到我的代碼,當我測試了它,使用PIP和Easy_install安裝熊貓

繼承人我的代碼:

import fileinput 
import csv 
import numpy 
import pandas 
#records = pe.iget_records(file_name="test.xlxs") 
records = pd.read_csv('test.csv', header=None, nrows=5) 

#To Write ni 





cho = raw_input("\nStart Forecaster on file?:<1/0>") 

if cho == 1: 

    for record in records: 
    rem = df.iloc([i], [0]) 
    print(rem) 
    sold1 = df.iloc([i], [1]) 
    print(sold1) 
    sold2 = df.iloc([i], [2]) 
    print(sold2) 

    rem = int(rem) 
    sold1 = int(sold1) 
    sold2 = int(sold2) 

    result = forecast(rem,sold1,sold2) 
    print(result) 
    df.set_value([i], [4], result) 
    pd.to_csv('test.csv') 
    print "Forecast Complete! Please check the file!" 


else: 
    quit() 

,但我得到這個錯誤:

Traceback (most recent call last): 
     File "tester.py", line 4, in <module> 
     import pandas 
     File "C:\Python27\lib\site-packages\pandas\__init__.py", line 25, in <module> 
     from pandas import hashtable, tslib, lib 
     File "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:40866) 
    ValueError: numpy.dtype has the wrong size, try recompiling. Expected 52, got 56 
+0

您應該刪除他們兩個和重用PIP安裝它們 – abccd

+0

嗯..你的意思是那些的easy_install? – dekt

+0

不,你爲什麼不刪除所有的熊貓和numpy,並使用點再次安裝它們 – abccd

回答

0

你將需要刪除的pandas所有以前的安裝和numpy,因爲你連續安裝它們太多次,導致圖書館感到困惑。刪除它們後,重新安裝pandasnumpy使用pip,就像這樣:

pip install numpy 
pip install pandas