一步真实解决TypeError: unlink() got an unexpected keyword argument ‘missing_ok‘

在谷歌服务器colab上跑yolo代码,训练自己的yolov5模型,遇到这个错误,可把我整不会了。。。

已经做好了数据集,建立了新的data下的yaml和model下的yaml文件,然后使用代码

!python train.py

运行train.py,但是出现了下面的问题:

Download error: [Errno 2] No such file or directory: '/content/drive/mydrive/yolov5-5.0/tmpnipjyz8i' Traceback (most recent call last): File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 39, in attempt_download torch.hub.download_url_to_file(url, file) File "/usr/local/lib/python3.7/dist-packages/torch/hub.py", line 471, in download_url_to_file f = tempfile.NamedTemporaryFile(delete=False, dir=dst_dir) File "/usr/lib/python3.7/tempfile.py", line 686, in NamedTemporaryFile (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type) File "/usr/lib/python3.7/tempfile.py", line 397, in _mkstemp_inner fd = _os.open(file, flags, 0o600) FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/mydrive/yolov5-5.0/tmpnipjyz8i' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 43, in attempt_download assert redundant, 'No secondary mirror' AssertionError: No secondary mirror During handling of the above exception, another exception occurred: Traceback (most recent call last): File "train.py", line 543, in <module> train(hyp, opt, device, tb_writer) File "train.py", line 86, in train attempt_download(weights) # download if not found locally File "/content/drive/MyDrive/yolov5-5.0/utils/google_utils.py", line 49, in attempt_download file.unlink(missing_ok=True) # remove partial downloads 

TypeError: unlink() got an unexpected keyword argument 'missing_ok'

具体见下图:

你是不是也这样了呢?

去网上找了几方法,发现自己看不懂或者是步适合自己的问题。。。。。

然后,我就看到了这一段提示

于是我就死马当做活马医,试着删掉这一行代码,然后重新使用代码

!python train.py

于是乎奇迹般地运行了,惊呆了老铁!

删掉的代码的位置在utils文件下的google_utiols.py 第49行上,删了它!

出现这个问题的可以试试本方法,如果有问题欢迎留言一起讨论,一起进步!

小白浅浅记录一波........期待后续更新

更多干货可以关注“蓝胖胖干货”,一枚励志带来干货的博主,和你一起进步!

  • 15
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝胖胖▸

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值