我使用PyInstaller生成的exe
文件存在AntiVirus误报问题,通过搜索,我发现这个答案包括重新编译引导程序,但我无法完成。这就是我迄今为止所尝试的:
- 尝试使用"choco install-y vcbuildtools"安装带有choco的C++构建工具,由于某些原因安装失败
- 从这里安装visualstudio社区,然后转到"cd引导程序",执行
python ./waf distclean all
得到错误can't open file './waf': [Errno 2] No such file or directory
- 安装MinGW-w64并设置路径,然后重试,我得到了相同的错误
或者可能有另一种方法可以使可执行文件不被检测为病毒/特洛伊木马。
使用的软件包:PyQt5、pysnmp、pandas、numpy。
编辑:感谢@Ana Knickerbocker的回答,我能够取得进展,现在当我运行python ./waf all
时,我得到了错误:Python Version : 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
Checking for 'msvc' (C compiler) : not found
Checking for 'gcc' (C compiler) : not found
Checking for 'clang' (C compiler) : not found
could not configure a C compiler!
我想我仍然没有编译器,我试过pip install vsbuildtools
,但我得到了这样的消息:No matching distribution found for vcbuildtools
有什么想法吗?
我在Windows 7 x64 上
嘿,你不需要visualstudio来构建pyinstaller的引导程序,如果你安装了python或python3,你可以在终端中完成。知道你在用哪一个是很重要的。我假设您使用python3,请在终端/命令行中尝试以下步骤:
-
git clone https://github.com/pyinstaller/pyinstaller
-
cd pyinstaller
,然后cd bootloader
-
运行
python3 ./waf distclean all
为您的系统构建引导加载程序。 -
一旦构建了引导加载程序,在pyinstaller目录中键入:
python3 setup.py install
(如果失败,pip install .
可能会工作( -
这应该已经安装了pyinstaller。在终端中键入pyinstaller,然后按enter键。它应该承认这个命令,但它会抱怨更多的争论。
-
使用命令
pyinstaller yourfile.py
创建可执行文件。
希望这能有所帮助!
对于任何收到错误"无法配置C编译器!"!
只需在机器上安装一个C编译器。
我安装了带有C++编译器的Visual Studio,因为它更简单、更合法。
https://visualstudio.microsoft.com/vs/features/cplusplus/
如果使用pip install …
,则不会安装引导加载程序源代码。您需要使用PyInstaller的源程序包(git克隆或从github下载存档(。
GitHub-引导程序问题
PyInstaller GitHub