簡體   English   中英

沒有這樣的文件或目錄:'final_data_1.npy'

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

我正在使用 tensorflow 和 numpy 嘗試此代碼。 但是,我收到一個錯誤。

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'

你能提出一個解決方案嗎?

像錯誤消息一樣,您必須命名此文件“final_data_1.npy”所在的正確目錄:

例子

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

function.load() 也一樣 你必須添加這個文件的目錄

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

如果不命名文件所在的目錄,您的計算機將不知道“final_data_1”在哪里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM