简体   繁体   中英

Python quit unexpectedly while using the libhdf5.103.dylib plug-in

I have a trained machine learning model named model.h5. I am using Keras to load model as

>>> from keras.models import load_model
>>> model=load_model("model.h5")

But the following error message gets printed.

Segmentation fault: 11

And then a pop-up occurs which says

Python quit unexpectedly while using the libhdf5.103.dylib plug-in.

On my Linux machine, the code is working and the model is loading, but on my Mac, the described error occurs. I am using Python 2.7.10.

Since you are running with Flask, your problem is likely that by default Flask uses a multi-threaded debug server (when you run flask run ), and HDF doesn't support multi-threading by default.

The easiest fix is to simply turn off multithreading for your flask server:

flask run --without-threads

You can also build HDF with threading support, but that's more difficult and not entirely supported. In production, this usually isn't a problem, because production WSGI servers use multiprocessing instead of multithreading.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM