假设文件结构:
pkg/
  __init__.py
  components/
    core.py
    __init__.py
  tests/
    core_test.py
    __init__.py


python -m 你的测试/预处理文件,即为
python -m pkg.tests.core_test.py

 

更多参考这里:http://stackoverflow.com/questions/11536764/attempted-relative-import-in-non-package-even-with-init-py

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-12-18
  • 2021-07-19
猜你喜欢
  • 2022-12-23
  • 2021-07-16
  • 2023-03-20
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案