我有两个python文件my_python.py
# my_pyhton.py
from myPython import my_utils
...
logger = my_utils.get_logger
..
和my_utils.py
都位于文件夹myPython
中:
# my_utils.py
def get_logger():
....
我可以在Eclipse PyDev中运行它们而没有任何问题,但是当我在命令行中运行它们时,出现如下错误:
Traceback (most recent call last):
File "my_pyhton.py", line 19, in <module>
from myPyhton import my_utils
ModuleNotFoundError: No module named 'myPython'
我该如何做才能像在Eclipse中一样运行它们?
答案 0 :(得分:0)
This is ok for my case
from my_utils import get_logger, get_driver, get_home_path