擅长:python、mysql、java
<p>这似乎取决于<code>sys.path</code></p>
<p>引用<a href="https://docs.python.org/3/tutorial/modules.html#the-module-search-path" rel="nofollow noreferrer">https://docs.python.org/3/tutorial/modules.html#the-module-search-path</a>:</p>
<blockquote>
<p>When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path. sys.path is initialized from these locations: [edit: presumably in this order]</p>
<p>The directory containing the input script (or the current directory when no file is specified).</p>
<p>PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).</p>
<p>The installation-dependent default.</p>
</blockquote>
<p>接着说</p>
<blockquote>
<p>After initialization, Python programs can modify sys.path.</p>
</blockquote>
<p>这对我来说意味着理论上任何事情都可能发生:-/</p>
<p>我猜<code>module_stuff</code>与内置名不相同,因此排除了第一个</p>
<p>您可能知道,Python不会在一次运行中两次导入同一个模块。也许您可以通过对<code>module/module_stuff</code>做一个小更改并再次运行来测试它</p>