ModuleNotFoundError when running script from Terminal

前端 未结 2 1857
甜味超标
甜味超标 2021-02-12 15:28

I have the following folder structure:

  • app
    • __init__.py
    • utils
      • __init__.py
2条回答
  •  自闭症患者
    2021-02-12 16:17

    You probably want to run python -m products.fish. The difference between that and python products/fish.py is that the former is roughly equivalent to doing import products.fish in the shell (but with __name__ set to __main__), while the latter does not have awareness of its place in a package hierarchy.

提交回复
热议问题