pyinstall无法在Windows 10 64bit中构建pypcap

时间:2018-02-08 05:48:34

标签: pyinstaller

我尝试使用pyinstaller构建exe。

test.py是

print('hello')

warntest.txt

missing module named resource - imported by posix, D:\PythonTest\\test.py
missing module named posix - imported by os, D:\PythonTest\\test.py
missing module named _posixsubprocess - imported by subprocess, D:\PythonTest\\test.py
missing module named 'org.python' - imported by pickle, D:\PythonTest\\test.py, xml.sax
missing module named readline - imported by cmd, code, pdb, D:\PythonTest\\test.py
excluded module named _frozen_importlib - imported by importlib, importlib.abc, D:\PythonTest\\test.py
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, D:\PythonTest\\test.py
missing module named _winreg - imported by platform, D:\PythonTest\\test.py
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, D:\PythonTest\\test.py
missing module named 'java.lang' - imported by platform, D:\PythonTest\\test.py, xml.sax._exceptions
missing module named vms_lib - imported by platform, D:\PythonTest\\test.py
missing module named termios - imported by tty, D:\PythonTest\\test.py, getpass
missing module named grp - imported by shutil, tarfile, D:\PythonTest\\test.py
missing module named pwd - imported by posixpath, shutil, tarfile, http.server, webbrowser, D:\PythonTest\\test.py, netrc, getpass
missing module named _dummy_threading - imported by dummy_threading, D:\PythonTest\\test.py
missing module named org - imported by copy, D:\PythonTest\\test.py

dist test.exe在某些计算机上运行。

然后我尝试使用pypcap添加代码:

import pcap
pc = pcap.pcap()
for d,b in pc:
    print(d,b)

pyinstaller test.py

warntest.txt同样是旧的。没有丢失pcap或pypcap。

missing module named resource - imported by posix, D:\PythonTest\\test.py
missing module named posix - imported by os, D:\PythonTest\\test.py
missing module named _posixsubprocess - imported by subprocess, D:\PythonTest\\test.py
missing module named org - imported by pickle, D:\PythonTest\\test.py
missing module named readline - imported by cmd, code, pdb, D:\PythonTest\\test.py
excluded module named _frozen_importlib - imported by importlib, importlib.abc, D:\PythonTest\\test.py
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, D:\PythonTest\\test.py
missing module named _winreg - imported by platform, D:\PythonTest\\test.py
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, D:\PythonTest\\test.py
missing module named 'java.lang' - imported by platform, D:\PythonTest\\test.py, xml.sax._exceptions
missing module named vms_lib - imported by platform, D:\PythonTest\\test.py
missing module named termios - imported by tty, D:\PythonTest\\test.py, getpass
missing module named grp - imported by shutil, tarfile, D:\PythonTest\\test.py
missing module named pwd - imported by posixpath, shutil, tarfile, http.server, webbrowser, D:\PythonTest\\test.py, netrc, getpass
missing module named _dummy_threading - imported by dummy_threading, D:\PythonTest\\test.py
missing module named 'org.python' - imported by copy, D:\PythonTest\\test.py, xml.sax

dist test.exe在我的构建计算机上运行。 另一台计算机提示DLL加载失败:

PS C:\ Users \ Jack \ Desktop \ dist \ test> \ TEST.EXE

您好

追踪(最近一次呼叫最后一次):

文件" test.py",第10行,

文件" D:\ PythonEnvi \ lib \ site-packages \ PyInstaller \ loader \ pyimod03_importers.py",第714行,在load_module中

ImportError:DLL加载失败:找不到指定的模块。

[2360]无法执行脚本测试

第10行是:

import pcap

所以我尝试其他方式: pyinstaller.exe --hidden-import pcap test.py pyinstaller.exe -p D:\ PythonEnvi \ Lib \ site-packages --hidden-import pcap D:\ PythonTest \ test.py

windows10 Home 64bit

python 3.63

pyinstaller 3.3.1

pypcap 1.20

npcap 0.98安装程序

npcap sdd 0.1

Microsoft Visual C ++ Build Tools 2015

1 个答案:

答案 0 :(得分:1)

无意中,我解决了这个问题。

pypcap需要npcap和winpcap API。

不同的计算机使用winpcapAPI安装npcap,

然后在不同的计算机上构建exe工作。

构建时间inmport pcap。 开始他们检查pcap winpcapAPI。 所以dll输了。

只需使用winpcapAPI安装npcap,然后构建工作。