在已安装的软件包h5py中获取导入错误

2024-09-27 00:20:41 发布

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

获取h5py的导入错误,但我已经安装了它。但它是在pythonshell中工作的

import numpy as np
from urllib.request import urlretrieve
import os
import h5py


if not os.path.isfile('datasets/mini.h5'):
    print("Downloading Conceptnet Numberbatch word embeddings...")
    conceptnet_url = 'http://conceptnet.s3.amazonaws.com/precomputed- 
    data/2016/numberbatch/17.06/mini.h5'
    urlretrieve(conceptnet_url, 'datasets/mini.h5')


with h5py.File('datasets/mini.h5', 'r') as f:
    all_words = [word.decode('utf-8') for word in f['mat']['axis1'][:]]
    all_embeddings = f['mat']['block0_values'][:]

我得到的错误是:

import h5py
ImportError: DLL load failed while importing _errors: The specified module could not be found.

Tags: importurlosas错误notallword

热门问题