Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何使用 pyinstaller 打包 #275

Open
carter115 opened this issue Nov 19, 2024 · 1 comment
Open

如何使用 pyinstaller 打包 #275

carter115 opened this issue Nov 19, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@carter115
Copy link

pyinstaller打包exe,运行报错

打包命令:pyinstaller demo.py

运行:demo.exe

  File "demo.py", line 1, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
  File "wcferry\__init__.py", line 3, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
  File "wcferry\client.py", line 19, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
  File "pynng\__init__.py", line 3, in <module>
ModuleNotFoundError: No module named '_cffi_backend'
[PYI-17568:ERROR] Failed to execute script 'demo' due to unhandled exception!

使用环境(请补全下列信息):

  • 操作系统:win11
  • 操作系统版本:64位
  • Python 版本:39.3.2
@carter115 carter115 added the bug Something isn't working label Nov 19, 2024
@lich0821 lich0821 added help wanted Extra attention is needed and removed bug Something isn't working labels Nov 19, 2024
@lich0821 lich0821 changed the title [🐛BUG] pyinstaller打包exe,运行报错 如何使用 pyinstaller 打包 Nov 19, 2024
@carter115
Copy link
Author

  • 打包命令
pyinstaller --add-binary "C:/Users/Xxxxxx/miniconda3/envs/Xxxxx/Lib/site-packages/wcferry/sdk.dll;wcferry" --add-binary "C:/Users/Xxxxxx/miniconda3/envs/Xxxxx/Lib/site-packages/wcferry/spy.dll;wcferry" --add-binary "C:/Users/Xxxxxx/miniconda3/envs/Xxxxx/Lib/site-packages/wcferry/spy_dev.dll;wcferry" --add-binary "C:/Users/Xxxxxx/miniconda3/envs/Xxxxx/Lib/site-packages/wcferry/spy_debug.dll;wcferry" --hidden-import=_cffi_backend main.py

--hidden-import 导入模块 _cffi_backend
--add-binary 添加dll文件

  • 检查目录下的文件已经存在

_cffi_backend, sdk.dll, spy.dll, spy_dev.dll, spy_debug.dll,

└─main
    │  main.exe
    │
    └─_internal
        │  ......
        │  _cffi_backend.cp311-win_amd64.pyd
        │
        │  ......
        │
        ├─pynng
        │      _nng.pyd
        │
        ├─wcferry
        │  │  sdk.dll
        │  │  spy.dll
        │  │  spy_debug.dll
        │  │  spy_dev.dll
        │  │
        │  └─.dl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants