can‘t open/read file: check file path/integrity

原因:

1、和其他人说的一样,是路径包含中文文件夹。
2、使用的相对路径:cv2.imread('1.jpg'),但是python命令行所在的目录,不是当前.py程序的目录:
can‘t open/read file: check file path/integrity_第1张图片

解决方法:

1、在执行语句开头添加一行代码:os.chdir(sys.path[0])
can‘t open/read file: check file path/integrity_第2张图片

你可能感兴趣的:(python)