python - 导入错误: DLL load failed while importing defs: The specified procedure could not be found

标签 python anaconda h5py

我已经使用 conda install h5py 安装了 h5py。但是,当我 import h5py 时,出现了上述错误。这是整个错误:

Traceback (most recent call last):
  File "training.py", line 12, in <module>
    import h5py
  File "C:\Users\colin\anaconda3\envs\py38\lib\site-packages\h5py\__init__.py", line 33, in <module>
    from . import version
  File "C:\Users\colin\anaconda3\envs\py38\lib\site-packages\h5py\version.py", line 15, in <module>
    from . import h5 as _h5
  File "h5py\h5.pyx", line 1, in init h5py.h5
ImportError: DLL load failed while importing defs: The specified procedure could not be found.

谢谢。

最佳答案

我尝试了 h5pyhdf5 版本的不同组合,甚至是最新版本。他们都不为我工作。所以我做了以下事情,它对我有帮助:

  • 卸载了 h5pyhdf5(conda uninstall)
  • pip install h5py(不是conda install)

所以我在 conda 环境中只使用了 h5py

即使认为它有一些缺点,正如 takluyver 在他的帖子中提到的:https://github.com/conda-forge/h5py-feedstock/issues/103#issuecomment-1017537370

The wheel package (what you get with pip) bundles libhdf5 into the wheel, so it should never 🤞 have a mismatch between the HDF5 used to build h5py and the HDF5 it finds at runtime. That approach has its downsides, though - e.g. the read-only S3 driver is enabled in conda-forge, but not in pip, because that would mean bundling more libraries.

关于python - 导入错误: DLL load failed while importing defs: The specified procedure could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68296054/

相关文章:

python - 在 Python27 上安装 netaddr

python - Anaconda 3 和 Python 3.7 的 Pyinstaller 无法工作?

python - 如何将所有 conda 环境放入一个文件夹

python - numpy,h5py : How do I make an array sorted by one of its columns from a bigger one saved with h5py?

python - 将函数应用于列表中的所有项目

python - 如何获取Python Scrapy工具抓取的Item数量?

python - Pyodbc 在非 conda python 中工作,但无法在 conda 中加载驱动程序

python - h5py 安装后报错

python - 有没有办法获取存储在 hdf5 文件中的数组切片的 numpy 样式 View ?

python:如何转义路径中的斜线?