python错误:找不到导入模块

2024-04-26 03:20:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在我的EC2上运行python API, 我一直在我的Mac上用PyCharm开发应用程序,我可以编译它,因为我的主目录是“模块的根目录” 当我试图从任何终端运行我的代码时,我得到了这个错误。在

File "runserver.py", line 2, in <module>
from app import app
File "path to the __init__.py file", line 12,    in <module>
import call.authien
ModuleNotFoundError: No module named 'call'

以下是我的文件结构:

^{pr2}$

导入模块位于app/__init__.py

from flask import Flask
from flask_httpauth import HTTPBasicAuth
from flask_sqlalchemy import SQLAlchemy
from werkzeug.utils import secure_filename
import os
app = Flask(__name__,static_url_path='')
app.config.from_object('config')

db = SQLAlchemy(app)
auth = HTTPBasicAuth()

import call.authien

import routes.users
import routes.hours
import routes.pref

Tags: 模块pathinfrompyimportappflask