google-colaboratory - FileNotFoundError:[Errno 2] 没有这样的文件或目录:'/content/drive/My'
问题描述
你们有没有遇到过这个错误?
我正在为我的小项目使用 GoogleColab。对于我的项目,我重新安装了 keras 2.1.5 & tensorflow 1.4 甚至没有忘记重启运行时。
这是错误代码:
/usr/local/lib/python3.6/dist-packages/PIL/Image.py in open(fp, mode)
[2808] if filename:
-> [2809] fp = builtins.open(filename, "rb")
[2810] exclusive_fp = True
[2811]
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/My'
我有一个名为“/content/drive/My Drive/Folder/Folder”的文件夹(是的,“My”和“Drive”之间有一个“空格”)。我认为这是一种错误或某事,不是吗?我试图将该文件夹名称修复为“My_Drive”或“MyDrive”,但 Google 不接受修复该名称。
或者有什么解决办法吗?请帮我。
+)
这里是整个代码:(基本上来自yolov3-to-keras https://github.com/qqwweee/keras-yolo3.git)
!pip install q keras==2.2.4
%tensorflow_version 1.x
from google.colab import drive
drive.mount('/content/drive/')
cd 'drive/My Drive'
...same as train.py...
def _main():
annotation_path = 'train_all.txt'
log_dir = 'logs/000/'
classes_path = 'classes.txt'
anchors_path = 'model_data/tiny_yolo_anchors.txt'
class_names = get_classes(classes_path)
num_classes = len(class_names)
anchors = get_anchors(anchors_path)'
...same as 'train.py'...
_main()
而且我还尝试复制路径并使用它,但没有奏效。在它们之间添加'\',没有用。
快把我逼疯了哈!
解决方案
你可以试试 if'My\ Drive'
工作,而不是'My Drive'
推荐阅读
- python - 使用 ruamel.yaml 更新包含多个 yaml 的 yaml 文件中的 yaml 块
- java - Apache Mina Core 不兼容的类更改错误
- shell - 在不关闭 vim 编辑器的情况下切换文件
- ios - Xcode Projects 的模拟器是空白的
- scala - Jsoup 按包含单引号的属性选择(Scala)
- java - Android 应用程序无法再访问服务器文件
- jquery - 为什么在 MVC 应用程序中多次加载部分?
- python - Python 2 xml.dom - 更改元素前缀
- vba - 对于每个形状宏不会在 PowerPoint VBA 中一次删除所有形状
- php - 不工作!==NULL