警告! ***HDF5 库版本不匹配错误*** python pandas windows

Warning! ***HDF5 library version mismatched error*** python pandas windows

我正在使用 pandas/python 以 HDFStore 格式保存 DataFrame。当我应用 my_data_frame.to_hdf(arguments...) 命令时出现错误消息:警告! ***HDF5 库版本不匹配错误 *** 并且我的程序已停止。

我正在开发 Windows 7(64 位),使用 Python 3.5.2 :: Anaconda 4.1.1(64 位)。

我一直在阅读有关此错误消息的信息,它说这是我计算机上安装的 HDF5 版本与 Anacondas 使用的版本之间的问题。根据 this post,一个简单的 "conda install -c anaconda hdf5=1.8.18" 可以解决我的问题,但我仍然有同样的消息错误。

感谢大家的帮助。

这里我放了一个完整的错误日志:


    Warning! ***HDF5 library version mismatched error***
    The HDF5 header files used to compile this application do not match
    the version used by the HDF5 library to which this application is linked.
    Data corruption or segmentation faults may occur if the application continues.
    This can happen when an application was compiled by one version of HDF5 but
    linked with a different version of static or shared HDF5 library.
    You should recompile the application or check your shared library related
    settings such as 'LD_LIBRARY_PATH'.
    You can, at your own risk, disable this warning by setting the environment
    variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
    Setting it to 2 or higher will suppress the warning messages totally.
    Headers are 1.8.15, library is 1.8.18
          SUMMARY OF THE HDF5 CONFIGURATION
          =================================

    General Information:
    -------------------
                       HDF5 Version: 1.8.18
                      Configured on: 2017-05-31
                      Configured by: NMake Makefiles
                     Configure mode: CMAKE 3.8.0
                        Host system: Windows-6.3.9600
                  Uname information: Windows
                           Byte sex: little-endian
                          Libraries:
                 Installation point: C:/bld/hdf5_1496269860661/_b_env/Library

    Compiling Options:
    ------------------
                   Compilation Mode: RELEASE
                         C Compiler: C:/Program Files (x86)/Microsoft Visual Studio
    14.0/VC/bin/amd64/cl.exe
                             CFLAGS: /DWIN32 /D_WINDOWS /W3
                          H5_CFLAGS:
                          AM_CFLAGS:
                           CPPFLAGS:
                        H5_CPPFLAGS:
                        AM_CPPFLAGS:
                   Shared C Library: YES
                   Static C Library: YES
      Statically Linked Executables: OFF
                            LDFLAGS: /machine:x64
                         AM_LDFLAGS:
                    Extra libraries: C:/bld/hdf5_1496269860661/_b_env/Library/lib/z.
    lib
                           Archiver:
                             Ranlib:
                  Debugged Packages:
                        API Tracing: OFF

    Languages:
    ----------
                            Fortran: OFF
                   Fortran Compiler:
              Fortran 2003 Compiler:
                      Fortran Flags:
                   H5 Fortran Flags:
                   AM Fortran Flags:
             Shared Fortran Library: YES
             Static Fortran Library: YES

                                C++: ON
                       C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio
    14.0/VC/bin/amd64/cl.exe
                          C++ Flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc
                       H5 C++ Flags:
                       AM C++ Flags:
                 Shared C++ Library: YES
                 Static C++ Library: YES

    Features:
    ---------
                      Parallel HDF5: OFF
                 High Level library: ON
                       Threadsafety: ON
                Default API Mapping: v18
     With Deprecated Public Symbols: ON
             I/O filters (external):  DEFLATE
                                MPE:
                         Direct VFD:
                            dmalloc:
    Clear file buffers before write: ON
               Using memory checker: OFF
             Function Stack Tracing: OFF
          Strict File Format Checks: OFF
       Optimization Instrumentation:

 Headers are 1.8.15, library is 1.8.18

你的错误信息显示,那么,你需要安装1.8.15版本。

conda install -c anaconda hdf5=1.8.15

万一有人遇到这个问题,并且使用 pipconda 或任何方法都无法卸载:我遍历了每个 /lib 路径并手动删除了 libhdf5* 文件,然后安装 hdf5macports

尝试卸载h5py模块并重新安装。这为我修复了它

  1. pip uninstall h5py
  2. pip install h5py

在 macOS 上对我有用的唯一过程是创建一个 virtualenv:

virtualenv -p python3 myenv
. myenv/bin/activate
pip3 install h5py==1.10.4 # or whichever version you want

绝对没有别的办法!

您可能需要 brew install hdf5

github 没有帮助的问题:

https://github.com/h5py/h5py/issues/1068

您可以强制自定义安装特定的软件包版本:

conda install --force-reinstall anaconda hdf5==1.8.15

conda install -c conda-forge hdf5=1.8.15

出于某种原因,使用 conda 卸载然后再次使用 conda 安装 hdf5 无效。但是,如果你用pip卸载,然后用conda安装hdf5,就可以了。

所以尝试:

pip uninstall hdf5
conda install hdf5

我尝试了这里的所有方法,但只有其他方法完全有效 -

conda install -c conda-forge hdf5=1.10.5 # newer system version
conda install -c conda-forge hdf5=1.8.18 # for this particular problem

这将通过升级或降级强制安装您的 hdf5。这反过来会卸载keras,当你重新安装升级hdf5的keras时。

我的案例很简单,不需要任何安装:我已经使用 cmd:[=22 从 conda 环境启动了 spyder 和一个 IPython 控制台=]

activate env
spyder

然后我使用 condacmd 中的 env 升级了 hdf5。但是,在 运行 我的代码在同一个 IPython 控制台中之后,我收到了类似的错误消息。所要做的就是重新启动 spyder 和相应的 IPython 控制台。我想这会一致地重新加载包。