擅长:python、mysql、java
<p>正如python文档中提到的:</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:</p>
<ol>
<li>The directory containing the input script (or the current directory when no file is specified). </li>
<li>PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH). </li>
<li>The installation-dependent default.</li>
</ol>
</blockquote>
<p>在编写<code>import mypackage.utils as u</code>时,mypackage目录应该在PYTHONPATH环境变量中指定。你知道吗</p>