树莓派3B Raspbian系统h5py导入错误:libhdf5_serial.so.100找不到
libhdf5_serial.so.100 Import Error for h5py on Raspberry Pi 3 Model B Hey there, let's get this h5py import issue sorted out quickly. That error means your system is missing the required HDF5 shared library that h5py depends on—even though you installed h5py via pip, the underlying system-level library isn't present or linked correctly. Here's how to fix it step by step:
Step 1: Install the Missing System Library
The libhdf5_serial.so.100 file is part of Raspbian's official package repository. First, update your package lists to make sure you're pulling the latest versions:
sudo apt update
Then install the specific library package that provides the missing file:
sudo apt install libhdf5-serial100
This will install the exact shared object file your Python 3.5 h5py installation is looking for.
Step 2: (Optional) Use System-Packaged h5py for Better Compatibility
If you still run into issues after installing the library, consider using the Raspbian-provided h5py package instead of the pip-installed one. It's pre-built to work with the system's HDF5 libraries, which avoids version mismatches:
sudo apt install python3-h5py
This will overwrite your pip-installed h5py with the system-compatible version.
Step 3: Verify the Fix
Test if h5py imports correctly by running this command in your terminal:
python3.5 -c "import h5py; print('h5py imported successfully! Version:', h5py.__version__)"
If you see the success message and version number, you're good to go.
Why This Happens
When you install h5py via pip, it sometimes relies on the system's existing HDF5 libraries instead of bundling its own. On your pre-installed Raspbian system, that specific HDF5 library version wasn't present, leading to the "cannot open shared object file" error. Installing the system library fills that gap, or switching to the system-provided h5py ensures full compatibility with Raspbian's libraries.
内容的提问来源于stack exchange,提问作者jordan mark

