报错Cannot rely on checking for EEXIST, since the operating system如何处理

看李沐大神的课的时候,复制代码进去产生了如上报错。

代码为:

import os
os.makedirs(os.path.join('..', 'data'), exist_ok=True)
data_file = os.path.join('..', 'data', 'house_tiny.csv')
with open(data_file, 'w') as f:
    f.write('NumRooms,Alley,Price\n')  # 列名
    f.write('NA,Pave,127500\n')  # 每行表示一个数据样本
    f.write('2,NA,106000\n')
    f.write('4,NA,178100\n')
    f.write('NA,NA,140000\n')

报错为:

PermissionError                           Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_1068/2297247830.py in <module>
      1 import os
----> 2 os.makedirs(os.path.join('..', 'data'), exist_ok=True)
      3 data_file = os.path.join('..', 'data', 'house_tiny.csv')
      4 with open(data_file, 'w') as f:
      5     f.write('NumRooms,Alley,Price\n&
PermissionError Traceback (most recent call last) Cell In[59], line 4 1 # 通过ToTensor实例将图像数据从PIL类型变换成32位浮点数格式, 2 # 并除以255使得所有像素的数值均在0~1之间 3 trans = transforms.ToTensor() ----> 4 mnist_train = torchvision.datasets.FashionMNIST( 5 root="../data", train=True, transform=trans, download=True) 6 mnist_test = torchvision.datasets.FashionMNIST( 7 root="../data", train=False, transform=trans, download=True) File E:\Anaconda\envs\d2l\lib\site-packages\torchvision\datasets\mnist.py:100, in MNIST.__init__(self, root, train, transform, target_transform, download) 97 return 99 if download: --> 100 self.download() 102 if not self._check_exists(): 103 raise RuntimeError("Dataset not found. You can use download=True to download it") File E:\Anaconda\envs\d2l\lib\site-packages\torchvision\datasets\mnist.py:180, in MNIST.download(self) 177 if self._check_exists(): 178 return --> 180 os.makedirs(self.raw_folder, exist_ok=True) 182 # download files 183 for filename, md5 in self.resources: File E:\Anaconda\envs\d2l\lib\os.py:215, in makedirs(name, mode, exist_ok) 213 if head and tail and not path.exists(head): 214 try: --> 215 makedirs(head, exist_ok=exist_ok) 216 except FileExistsError: 217 # Defeats race condition when another thread created the path 218 pass File E:\Anaconda\envs\d2l\lib\os.py:215, in makedirs(name, mode, exist_ok) 213 if head and tail and not path.exists(head): 214 try: --> 215 makedirs(head, exist_ok=exist_ok) 216 except FileExistsError: 217 # Defeats race condition when another thread created the path 218 pass File E:\Anaconda\envs\d2l\lib\os.py:225, in makedirs(name, mode, exist_ok) 223 return 224 try: --> 225 mkdir(name, mode) 226 except OSError: 227 # Cannot rely on checking for EEXIST, since the operating system 228 # could give priority to other errors like EACCES or EROFS 229 if not exist_ok or not path.isdir(name): PermissionError: [WinError 5] 拒绝访问。: &#39;../data&#39;什么意思
最新发布
03-09
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值