在Pyarm中安装Keras导致故障

2024-06-12 07:18:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用Keras进行时间序列预测,但在安装Keras库时遇到了一个错误。 以下是我收到的一条错误消息:

Collecting keras
  Using cached Keras-2.4.3-py2.py3-none-any.whl (36 kB)
Requirement already satisfied: numpy>=1.9.1 in e:\program files (x86)\pythonworkspace\r&dproject\venv\lib\site-packages (from keras) (1.20.1)
Collecting h5py
  Using cached h5py-3.2.1.tar.gz (368 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Requirement already satisfied: scipy>=0.14 in e:\program files (x86)\pythonworkspace\r&dproject\venv\lib\site-packages (from keras) (1.6.1)
Collecting pyyaml
  Using cached PyYAML-5.4.1-cp38-cp38-win32.whl (196 kB)
Building wheels for collected packages: h5py
  Building wheel for h5py (PEP 517): started
  Building wheel for h5py (PEP 517): finished with status 'error'
Failed to build h5py

DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated and has no effect anymore. pip 21.1 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
  ERROR: Command errored out with exit status 1:
   command: 'E:\Program Files (x86)\PythonWorkspace\R&DProject\venv\Scripts\python.exe' 'E:\Program Files (x86)\PythonWorkspace\R&DProject\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Pdani\AppData\Local\Temp\tmp3bkex0vs'
       cwd: C:\Users\Pdani\AppData\Local\Temp\pip-install-ohk956w8\h5py_04e48a12b76742f58110ae0bdae41c39
  Complete output (73 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win32-3.8
  creating build\lib.win32-3.8\h5py
  copying h5py\h5py_warnings.py -> build\lib.win32-3.8\h5py
  copying h5py\ipy_completer.py -> build\lib.win32-3.8\h5py
  copying h5py\version.py -> build\lib.win32-3.8\h5py
  copying h5py\__init__.py -> build\lib.win32-3.8\h5py
  creating build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\attrs.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\base.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\compat.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\dataset.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\datatype.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\dims.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\files.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\filters.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\group.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\selections.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\selections2.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\vds.py -> build\lib.win32-3.8\h5py\_hl
  copying h5py\_hl\__init__.py -> build\lib.win32-3.8\h5py\_hl
  creating build\lib.win32-3.8\h5py\tests
  copying h5py\tests\common.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\conftest.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_attribute_create.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_attrs.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_attrs_data.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_base.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_big_endian_file.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_completions.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dataset.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dataset_getitem.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dataset_swmr.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_datatype.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dimension_scales.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dims_dimensionproxy.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_dtype.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_errors.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_file.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_file2.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_file_image.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_filters.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_group.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5d_direct_chunk.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5f.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5o.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5p.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5pl.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_h5t.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_objects.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_selections.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\test_slicing.py -> build\lib.win32-3.8\h5py\tests
  copying h5py\tests\__init__.py -> build\lib.win32-3.8\h5py\tests
  creating build\lib.win32-3.8\h5py\tests\data_files
  copying h5py\tests\data_files\__init__.py -> build\lib.win32-3.8\h5py\tests\data_files
  creating build\lib.win32-3.8\h5py\tests\test_vds
  copying h5py\tests\test_vds\test_highlevel_vds.py -> build\lib.win32-3.8\h5py\tests\test_vds
  copying h5py\tests\test_vds\test_lowlevel_vds.py -> build\lib.win32-3.8\h5py\tests\test_vds
  copying h5py\tests\test_vds\test_virtual_source.py -> build\lib.win32-3.8\h5py\tests\test_vds
  copying h5py\tests\test_vds\__init__.py -> build\lib.win32-3.8\h5py\tests\test_vds
  copying h5py\tests\data_files\vlen_string_dset.h5 -> build\lib.win32-3.8\h5py\tests\data_files
  copying h5py\tests\data_files\vlen_string_dset_utc.h5 -> build\lib.win32-3.8\h5py\tests\data_files
  copying h5py\tests\data_files\vlen_string_s390x.h5 -> build\lib.win32-3.8\h5py\tests\data_files
  warning: build_py: byte-compiling is disabled, skipping.
  
  running build_ext
  Loading library to get build settings and version: hdf5.dll
  error: Unable to load dependency HDF5, make sure HDF5 is installed properly
  error: Could not find module 'hdf5.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  ----------------------------------------
  ERROR: Failed building wheel for h5py
ERROR: Could not build wheels for h5py which use PEP 517 and cannot be installed directly

我已经尝试过不同的解决方案,比如将Python解释器从3.9降级到3.7,将pip更新到一个新版本,但到目前为止没有任何效果。现在我完全累坏了


Tags: pytestbuildcreatingdatalibwithtests
1条回答
网友
1楼 · 发布于 2024-06-12 07:18:25

确保已安装64位python

此错误可能是由于旧的pip版本造成的。升级pip

pip3 install upgrade pip

然后尝试直接安装h5py:

pip install h5py

并重新安装Keras:

pip install keras

相关问题 更多 >