擅长:python、mysql、java
<p>只需将这些行添加到要执行的文件的顶部</p>
<pre class="lang-py prettyprint-override"><code>if __name__ == "__main__":
import os
import sys
sys.path.append(os.getcwd())
</code></pre>
<blockquote>
<p>These script add the directory, where file in, to your path when executing directly which <code>__name__ == "__main__"</code> means.</p>
</blockquote>