我刚刚从Python 2.7迁移到3.5。最近我一直在使用下面的代码
import pandas as pd
import os
import glob as g
import numpy as np
archivos = g.glob('/compartido/FICHEROS_IC/MODELOS/archivosXML/ConvertidosXML/*_LEITURAS_*.csv')
vuelta=0
for archiv in archivos:
a=os.path.basename(archiv)
nomarch= os.path.splitext(a)[0]
nombre = os.path.splitext(archiv)[0]
df = pd.read_csv(archiv, sep=",")
d = pd.to_datetime(df['DATA_LEITURA'], format="%Y%m%d")
df['FECHA_LECTURA'] = d.dt.date
del df['DATA_LEITURA']
order = df.sort_values(['NR_CPE','FECHA_LECTURA', 'HORA_LEITURA'], ascending=True)
grouped = order.groupby('NR_CPE')
order["CONSUMO"]= order.VALOR_LEITURA - order.groupby(['NR_CPE'])['VALOR_LEITURA'].shift(1).fillna(0)
order["DIAS"]= order.FECHA_LECTURA - order.groupby(['NR_CPE'])['FECHA_LECTURA'].shift(1)
order["DIAS"]= order["DIAS"].replace('NaT',0)
order["DIAS"]= order["DIAS"].astype('timedelta64[D]')
numday = grouped['DIAS'].size() > 1
sumday = grouped['DIAS'].sum()
day = sumday[numday]
numberocons = grouped['CONSUMO'].size() > 1
sumconsu = grouped['CONSUMO'].sum()
consu = sumconsu[numberocons]
canu = (consu/day) * 365
Fdias = day.map('{:.0f}'.format)
Fcanu = canu.replace('inf',0).map('{:.2f}'.format)
当我同时使用python 2.7和3.5时,此代码运行良好。本周我从我的系统中删除了python 2.7,现在我遇到了这个错误:
python:符号查找错误: /usr/local/anaconda3/lib/python3.5/site-packages/numexpr/../../../libmkl_vml_avx.so: 未定义的符号:mkl_serv_getenv
我发现我在以下说明中遇到了错误:
canu = (consu/day) * 365 #Anual consumption
为什么会发生这种情况,以及如何解决这个问题?
我在Python 3.5.1上运行Anaconda 4.1.0(64位)