c++ - Including a C++ executable when freezing a Python script with PyInstaller
问题描述
I've tried to read through the PyInstaller documentation and using spec files, as well as Google/SO, but haven't found any clear answers.
I have written a python script using Biopython, and have made it into an executable with PyInstaller and it works fine. However the script uses a Biopython function (NcbiBlastnCommandline()) that is a wrapper for the NCBI Blast+ blastn program (written in C++), and at the moment the user still needs to have the NCBI Blast+ installed locally.
Is it possible to package the C++ .exe along with the rest, so the end user only needs to download my executable and nothing else?
解决方案
Read the part of the tutorial about adding binary files:
To add binary files, make a list of tuples that describe the files needed. Assign the list of tuples to the
binaries=
argument of Analysis.
a = Analysis(...
binaries=[ ( '/path/to/blastn.exe', 'blastn.exe' ) ],
...
推荐阅读
- javascript - React/Redux 中的父属性更新太晚
- ios - 外设特性的编写是否有保证的顺序?
- linux - Tty.c:可加载库和 perl 二进制文件不匹配
- pip - 如何在 Repl.it 上升级 pip 版本?
- adb - 如何从私钥中获取 adbkey.pub?
- c# - iText7:如何修复:一个带有两个梳子的 PdfTextFormField,SetValue No MaxLen 错误
- python - 使用python根据选择查询列执行更新
- javascript - 向下滚动离子选项列表时出现问题,向上和向下滚动时会选中复选框
- javascript - 将导出函数返回的数据传递给 React 组件
- google-bigquery - 如何更改 BigQuery 重复记录的 col 类型