一步真实解决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 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'

具体见下图:

一步真实解决TypeError: unlink() got an unexpected keyword argument ‘missing_ok‘_第1张图片

你是不是也这样了呢?

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

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

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

!python train.py

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

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

一步真实解决TypeError: unlink() got an unexpected keyword argument ‘missing_ok‘_第2张图片

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

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

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

你可能感兴趣的:(真实解决Bug,深度学习,人工智能)