如何从命令行运行不带模块的python

时间:2018-09-19 04:55:14

标签: python-3.x eclipse command-line python-module

我有两个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中一样运行它们?

1 个答案:

答案 0 :(得分:0)

This is ok for my case

from my_utils import get_logger, get_driver, get_home_path
相关问题