如何让pyzmq(14.3.1)和cx_Freeze(4.3.3)协同工作

0 投票
1 回答
627 浏览
提问于 2025-04-18 16:22

我该怎么让pyzmq(版本14.3.1)和cx_Freeze(版本4.3.3)一起工作呢?默认情况下,cx_Freeze在Windows上并不会把pyzmq需要的所有组件都包含进去。

1 个回答

2

以下对setup.py的调整对我来说有效,至少在Windows系统上是这样(见评论):

from cx_Freeze import setup, Executable
import zmq.libzmq

build_exe_options = {
    # zmq.backend.cython seems to be left out by default
    'packages': ['zmq.backend.cython', ],
    # libzmq.pyd is a vital dependency
    'include_files': [zmq.libzmq.__file__, ],
}

setup(
    name='myapp',
    version='0.0.1',
    description='My App',
    options={'build_exe': build_exe_options},
    executables=[Executable('bin/myapp.py')],
)

撰写回答