ModuleNotFoundError: No module named ‘config‘

ModuleNotFoundError: No module named 'config'

config是个py文件,不能直接from
 

from config import QINIU_AVAILABLE, OSS_AVAILABLE, REDIS_URI, BASEDIR

下面举个类似例子:

resize_img.py代码


import glob
import cv2
import os
import time
def resize_img():
    dir_path = r'D:\2439'

    files = glob.glob(dir_path + "/*.png") + glob.glob(dir_path + "/*.jpg")
    index = 0
    for file in files:
        img = cv2.imread(file)  # modify the image path to yours
        if img.shape[1] != 160:
            x_scale = 160 / img.shape[1]
            index += 1
            img = cv2.resize(img, None, fx=x_scale, fy=x_scale, interpolation=cv2.INTER_AREA)

            cv2.imwrite(file[:-4] + ".jpg", img)
            print(len(files), index)
if __name__ == '__main__

你可能感兴趣的:(python宝典,python)