当我尝试打开.h5
文件时,它显示以下错误
Traceback (most recent call last):
File "C:\Users\VW3ZTWS\PycharmProjects\Data_Collection_and_learnings\venv\lib\site-packages\IPython\core\interactiveshell.py", line 2869, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-10-524e5789c66b>", line 6, in <module>
f = h5py.File(filename, 'r+')
File "C:\Users\VW3ZTWS\PycharmProjects\Data_Collection_and_learnings\venv\lib\site-packages\h5py\_hl\files.py", line 394, in __init__
swmr=swmr)
File "C:\Users\VW3ZTWS\PycharmProjects\Data_Collection_and_learnings\venv\lib\site-packages\h5py\_hl\files.py", line 172, in make_fid
fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 85, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = '28ggv-016.h5.h5', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2)
我使用的代码:
import h5py
import numpy as np
import pandas as pd
filename = '28ggv-016.h5'
f = h5py.File(filename, 'r')
答案 0 :(得分:1)
Ctrl + Shift + C
复制文件的完整路径并将其粘贴到filename
中:
import h5py
import numpy as np
import pandas as pd
filename = 'dir:\your\path\to\the\file\28ggv-016.h5'
f = h5py.File(filename, 'r')