Python 使用pyinstaller将pytest与pytest_html模块打包
我在使用pyinstaller将带有pytest_html模块的pytest打包到可执行文件时遇到问题 在窗户上 当使用Python运行它时,它确实可以工作,但我需要将它打包为exe 我的示例代码:Python 使用pyinstaller将pytest与pytest_html模块打包,python,python-3.x,pytest,pyinstaller,pytest-html,Python,Python 3.x,Pytest,Pyinstaller,Pytest Html,我在使用pyinstaller将带有pytest_html模块的pytest打包到可执行文件时遇到问题 在窗户上 当使用Python运行它时,它确实可以工作,但我需要将它打包为exe 我的示例代码: import pytest import pytest_html def test_hello(): assert True pytest.main(["-p", "pytest_html","-vvv", "--ca
import pytest
import pytest_html
def test_hello():
assert True
pytest.main(["-p", "pytest_html","-vvv", "--capture=tee-sys","--html=report.html", __file__])
也与
pytest.main([“-vvv”、“-html=report.html”、\uuuuu file\uuuuu],插件=[pytest\u超时])
我正在运行的Pyinstaller命令是:
pyinstaller--noconfirm--onefile--nowindow--exclude module PyQt5--log-level DEBUG-n py_exe file.py
还尝试将其添加为隐藏模块,但没有成功
我得到的结果是:
错误:无法识别的参数:--html=report.html
查看Analysis-00.toc,我可以看到模块:
('pytest\u html','c:\\users\\nathan\\appdata\\local\\programs\\python\\python38-32\\lib\\site packages\\pytest\u html\\\\ uuu init\uuuuuu.py','PYMODULE')
版本:Windows 10,
Python 3.8.3,
pytest 5.4.3,
pytest html 2.1.1,
pyinstaller 3.6
编辑: 问题已解决,请参阅