简体   繁体   English

没有这样的文件或目录:'final_data_1.npy'

[英]No such file or directory: 'final_data_1.npy'

I am trying this code using tensorflow and numpy.我正在使用 tensorflow 和 numpy 尝试此代码。 However, I am getting an error.但是,我收到一个错误。

import numpy as np

from tensorflow.python.framework import ops

np.random.seed(1)

ops.reset_default_graph()
ops.reset_default_graph()

#final_data_1 and 2 are the numpy array files for the images in the folder img and annotations.csv file

#total of 5 GB due to conversion of values to int

Z2= np.load('final_data_1.npy')

Z1= np.load('final_data_2.npy')

print(Z2[:,0])

print(Z1.shape)

my error is:

FileNotFoundError: [Errno 2] No such file or directory: 'final_data_1.npy'

Can you suggest a solution?你能提出一个解决方案吗?

Like the Error message implies you have to name the right directory where this file "final_data_1.npy" is located at:像错误消息一样,您必须命名此文件“final_data_1.npy”所在的正确目录:

Example例子

import pandas as pd
df = pd.read_csv("./Path/where/you/stored/table/data.csv")
print(df)

Same goes with the function.load() You have to add the directory of this file function.load() 也一样 你必须添加这个文件的目录

np.load('./User/Desktop/final_data_1.npy')

Without naming the directory where the file is located your computer doesn't know where "final_data_1" is如果不命名文件所在的目录,您的计算机将不知道“final_data_1”在哪里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM