import pandas出现‘ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject’问题
一、问题描述:
主要出现了‘ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject’问题。全部错误代码如下:
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\InstallSoftware\Anaconda\envs\spyder_py3.5\lib\site-packages\pandas\__init__.py", line 31, in <module>
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
File "D:\InstallSoftware\Anaconda\envs\spyder_py3.5\lib\site-packages\pandas\_libs\__init__.py", line 3, in <module>
from .tslibs import (
File "D:\InstallSoftware\Anaconda\envs\spyder_py3.5\lib\site-packages\pandas\_libs\tslibs\__init__.py", line 3, in <module>
from .conversion import localize_pydatetime, normalize_date
File "__init__.pxd", line 918, in init pandas._libs.tslibs.conversion
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
二、问题分析:
出现这种原因是numpy与pandas版本不匹配。
三、问题解决:
重新安装numpy,版本为1.14.5。最开始先卸载,结果出现了错误代码,索性就直接安装特定版本的啦~~
pip install numpy==1.14.5
pip install --upgrade numpy
运行第二句命令时,虽然已经出现了问题,但我忽略了,并尝试导入两个包不再报错,也可以正常运行啦。