[英]FileNotFoundError: [Errno 2] No such file or directory, After copying pathname
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
I copy-pasted the pathname from the folder I want to extract images from, This same exact code was working before, but now I get the error message:我从要从中提取图像的文件夹中复制粘贴了路径名,以前可以使用相同的确切代码,但现在我收到错误消息:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/name/Desktop/cancer_data/stage_1_png'
check the filename again.再次检查文件名。 I think it should be stage_1.png instead of stage_1_png
我认为应该是stage_1.png而不是stage_1_png
It is a relative path.这是一个相对路径。 I prefer to use r"".
我更喜欢使用 r""。
shift
+ right click
on the image file. shift
+ right click
图像文件。 You will find a copy path
option and use that instead of path.您将找到一个
copy path
选项并使用它代替路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.