Python ModuleNotFoundError:没有名为“ xxx”的模块

时间:2020-01-15 10:48:04

标签: python flask import module path

Pycharm导入工作正常,但是当我在终端中执行test_settings.py时,出现此错误:

导入测试模块'/home/ed/PycharmProjects/TTime/tests/test_settings.py'时发生导入错误。

提示:请确保您的测试模块/程序包具有有效的Python名称。

跟踪: tests / test_settings.py:3:在 从ttime导入应用程序,数据库 E ModuleNotFoundError:没有名为“ ttime”的模块

这是我的Flask项目结构。我尝试将 init .py包含在主文件夹和tests文件夹中,但没有任何变化。 python路径似乎有问题。

.
├── config.py
├── README.md
├── requirements.txt
├── runserver.py
├── tests
│   ├── functional
│   │   └── __init__.py
│   ├── pytest.ini
│   ├── test_settings.py
│   └── unit
│       ├── __init__.py
│       └── test_models.py
└── ttime
    ├── __init__.py
    ├── models.py
    ├── routes.py
    ├── static
    └── templates
        ├── base.html
        └── index.html

0 个答案:

没有答案
相关问题