擅长:python、mysql、java
<p>正如Pawel Miech所说</p>
<blockquote>
<p>In your code sample you are making calls to twisted.reactor starting
it on every function call. This is not working because there is only
one reactor per process and you cannot start it twice.</p>
</blockquote>
<p>我找到了解决问题的方法。只是使用多重处理。在</p>
<p>就像:</p>
<pre><code>from multiprocessing import Process
def run_spider(keyword):
if __name__ == '__main__':
p = Process(target=jingdong_spider.search, args=(keyword.encode('utf-8'),))
p.start()
p.join()
</code></pre>
<p>如果每个人在使用python多处理时都有问题。最好看一下python文档。在</p>