docker python custom module not found

前端 未结 1 1488
灰色年华
灰色年华 2021-02-13 04:45

I am new to docker and trying to move one simple application to docker. Python standard modules I am able to import using \"pip install\". However, I have some custom python uti

相关标签:
1条回答
  • 2021-02-13 05:21

    You set PYTHONPATH to /test_project/utils. When trying resolve the module utils, it is looking for one of:

    • file /test_project/utils/utils.py
    • directory /test_project/utils/utils/ that contains __init__.py.

    It looks like you have this?

    utils/math.py
    utils/logger.py
    

    I wonder if what you really mean to do is

    # different path...
    ENV PYTHONPATH /test_project
    
    from utils import math
    from utils import logger
    
    0 讨论(0)
提交回复
热议问题