我试图在qpython中从一个简单的python脚本调用一个图像但是得到错误信息:
qpython android IOError: [Erno 2] No such file or directory
我想知道我是否使用了正确的目录约定?这是代码:
import numpy as np
from PIL import Image
spinner = {
1: Image.open('storage/emulated/0/qpython/scripts/shapes/norm.jpg','r'),
2: Image.open('storage/emulated/0/qpython/scripts/shapes/square.jpg','r'),
3: Image.open('storage/emulated/0/qpython/scripts/shapes/fly.jpg','r'),
4: Image.open('storage/emulated/0/qpython/scripts/shapes/tri.jpg','r'),
5: Image.open('storage/emulated/0/qpython/scripts/shapes/special.jpg','r'),
6: Image.open('storage/emulated/0/qpython/scripts/shapes/rect.jpg','r'),
7: Image.open('storage/emulated/0/qpython/scripts/shapes/salad.jpg','r'),
8: Image.open('storage/emulated/0/qpython/scripts/shapes/circle.jpg','r'),
9: Image.open('storage/emulated/0/qpython/scripts/shapes/banana.jpg','r')
}
如果没有' r'它会抛出相同的错误。论点。还试过双前轮和后轮反斜线......
答案 0 :(得分:0)
似乎你没有设置图像的完整路径,它会在绝对路径的开头错过斜杠。
尝试/存储/模拟.....而不是存储/模拟......