擅长:python、mysql、java
<p>如果从包含<em>brian</em>模块的目录启动<strong>python</strong>,那么一切都会像现在一样工作。在</p>
<p>要想从任何地方导入自定义模块,</strong>您应该仔细阅读python中有关导入机制的内容,以了解在何处搜索导入的模块等</p>
<p>但为了让您的代码立即生效,我可以向您推荐以下内容:</p>
<ul>
<li>在运行python之前,扩展<strong>PYTHONPATH</strong>变量,以包含模块的目录</li>
<li><p>或者以这种方式使用<strong>sys</strong>模块将其附加到代码中。在</p>
<blockquote>
<pre><code>import sys
sys.path.append("path/to/module/dir")
import brian
</code></pre>
</blockquote></li>
</ul>
<p>另外,请参阅关于<a href="http://docs.python.org/2.7/library/site.html#module-site" rel="nofollow">site</a>模块的信息</p>