【发布时间】:2022-01-15 18:39:29
【问题描述】:
x_train = []
for i in range(1, 4):
base_dir = f'/Users/name/Desktop/cancer_data/stage_1_png' #pathname that I copy-pasted
files = os.listdir(base_dir)
for file in tqdm(files):
img = imread(base_dir+file)
x_train.append(img)
x_train = np.array(x_train)
x_train.shape
我从我要从中提取图像的文件夹中复制粘贴了路径名,以前可以使用相同的完全相同的代码,但现在我收到错误消息:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/name/Desktop/cancer_data/stage_1_png'
我在文件夹中按住 Option 键,然后单击“copyPathname”(在 Mac 上)。所以它不可能是一个不存在的路径/文件夹。
【问题讨论】:
-
我们无法验证路径是否正确,因此此类问题无法回答。
-
您的评论声称我的问题无法回答,但这个错误当然可以修复或提供建议,因为我之前遇到过同样的问题,但忘记了如何解决。
-
我在问题标题中写道,我复制粘贴了路径名?是否可以帮助您说我在目录中(在 Mac 上)中按住 Option 键,然后从我想从中提取图像的位置单击“copyPathname”?这怎么可能是一条不存在的路径?
标签: python tensorflow error-handling jupyter-notebook anaconda