admin管理员组

文章数量:1550371

今天使用numpy结合sklearn绘制曲线的时候发现抱错:

D:\Yolov3_Tensorflow\python\python.exe C:/Users/HuaWei/Desktop/绘制不同光照条件下识别率曲线图/plot.py
Traceback (most recent call last):
  File "C:/Users/HuaWei/Desktop/绘制不同光照条件下识别率曲线图/plot.py", line 14, in <module>
    from sklearn.linear_model import LinearRegression
  File "D:\Yolov3_Tensorflow\python\lib\site-packages\sklearn\__init__.py", line 82, in <module>
    from .base import clone
  File "D:\Yolov3_Tensorflow\python\lib\site-packages\sklearn\base.py", line 20, in <module>
    from .utils import _IS_32BIT
  File "D:\Yolov3_Tensorflow\python\lib\site-packages\sklearn\utils\__init__.py", line 22, in <module>
    from .murmurhash import murmurhash3_32
  File "__init__.pxd", line 918, in init sklearn.utils.murmurhash
ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

Process finished with exit code 1

可能是之前安装tensorflow的时候它自动安装了老版本的,查看当前numpy版本:

C:\Users\HuaWei>pip install numpy
Requirement already satisfied: numpy in d:\yolov3_tensorflow\python\lib\site-packages (1.15.1)

C:\Users\HuaWei>

卸载numpy重新安装一下试试:

C:\Users\HuaWei>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/53/74/b997e4c7b4abc668e99f4c3dba87ee2c6f7559319af756cc1ede37665a8d/numpy-1.18.1-cp36-cp36m-win_amd64.whl (12.8 MB)
     |████████████████████████████████| 12.8 MB 3.3 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.18.1

C:\Users\HuaWei>

完美,没再报错了,但是就是不知道tensorflow那边会怎么样。。。

参考文章:Python导入包时出现“numpy.ufunc size changed, may indicate binary incompatibility”错误

本文标签: 报错ufuncValueErrornumpybinary