`python file.py`和`python -m file`之间的区别

问题描述 投票:0回答:1

在python3中:

  • 调用python path/to/file.pypython -m path.to.file吗?

  • 它如何影响工作目录? (os.getcwd()

  • 它是否存在__init__.py存在的链接文件位于path/to吗?

我对在这些问题上发现的信息很少感到惊讶。也许我搜索的字词不正确?预先感谢!

python python-3.x python-module
1个回答
0
投票
python -m ...

用于运行python库模块,例如pip,IPython等。>

python file.py

但是用于通过python解释器运行文件。

© www.soinside.com 2019 - 2024. All rights reserved.