无法在 python 2.7 上运行并行 python (pp)

发布于 2024-10-05 08:51:40 字数 1314 浏览 0 评论 0原文

我正在开发带有 8 个处理器的 windows box。我必须运行一个执行海量数据处理的 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

I am working on windows box with 8 processors. I have to run a python script that does mass data processing. When run as such, the script uses only one processor. I learnt that, to harness the power of multiple processors, I can use parallel python (pp) library.

I installed the library on my machine and followed the instructions available at http://www.parallelpython.com/content/view/15/30/#QUICKSMP

However, the code to configure pp fails on my machine:

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
>>> 

Can you please tell me how do I get this resolved? I have installed pp version 1.6.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文