我正在使用8个处理器的Windows机箱。我必须运行一个执行海量数据处理的python脚本。如此运行时,脚本仅使用一个处理器。我了解到,为了利用多个处理器的强大功能,我可以使用并行python(pp)库。
我在我的机器上安装了该库,并按照http://www.parallelpython.com/content/view/15/30/#QUICKSMP
中的说明进行操作但是,配置pp的代码在我的机器上失败:
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pp
>>> job_server = pp.Server()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
job_server = pp.Server()
File "C:\Python27\lib\site-packages\pp.py", line 343, in __init__
self.set_ncpus(ncpus)
File "C:\Python27\lib\site-packages\pp.py", line 503, in set_ncpus
range(ncpus - len(self.__workers))])
File "C:\Python27\lib\site-packages\pp.py", line 148, in __init__
self.start()
File "C:\Python27\lib\site-packages\pp.py", line 161, in start
self.pid = int(self.t.receive())
File "C:\Python27\lib\site-packages\pptransport.py", line 134, in receive
msg_len = struct.unpack("!Q", size_packed)[0]
error: unpack requires a string argument of length 8
>>>
请告诉我如何解决这个问题?我已经安装了pp版本1.6.0