擅长:python、mysql、java
<p>通常的开发方法是使用virtualenv并在virtualenv中使用<code>pip install -e .</code>(这几乎相当于<code>python setup.py develop</code>)。现在,您的源目录被用作sys.path上的已安装包。</p>
<p>当然,还有很多其他方法可以让您的包在sys.path上进行测试,请参见<a href="https://stackoverflow.com/questions/20971619/ensuring-py-test-includes-the-application-directory-in-sys-path">Ensuring py.test includes the application directory in sys.path</a>以获得关于这个完全相同的问题的更完整的答案。</p>