2017年3月24日 星期五

[python]pyzmq 的 pyinstaller 打包失敗

這個也算是一拳解決,所以要先來描述一下問題。

環境

環境是 windows,python2.7,用 pip install zerorpc。
到了要打包的時候,pyinstaller 會吐出 warning:

4736 INFO: Looking for dynamic libraries
5439 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\message.pyd
5532 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_device.pyd
5641 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\utils.pyd
5735 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\socket.pyd
5844 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_poll.pyd
5937 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\context.pyd
6031 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\error.pyd
6125 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_version.pyd

真的執行的話,會出現:

File "site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
File "c:\users\cyrus\appdata\local\temp\pip-build-ont0l7\pyinstaller\PyInstall
er\loader\pyimod03_importers.py", line 546, in load_module
ImportError: DLL load failed: 找不到指定的模組。
Failed to execute script api

一拳

C:\Python27\Lib\site-packages\zmq\libzmq.pyd 要複製一份到 C:\Python27\Lib\site-packages\zmq\backend\cython\

搞定

沒有留言:

張貼留言