起因
开发一直使用python -m venv .pyenv 方式创建虚拟环境,在利用pyinstaller打包发布应用时,出现错误
3178 INFO: Warnings written to C:UsersxxxDesktophiPyuildhiwarn-hi.txt
3203 INFO: Graph cross-reference written to C:UsersxxxDesktophiPyuildhixref-hi.html
3295 INFO: checking PYZ
3295 INFO: Building PYZ because PYZ-00.toc is non existent
3297 INFO: Building PYZ (ZlibArchive) C:UsersxxxDesktophiPyuildhiPYZ-00.pyz
3587 INFO: Building PYZ (ZlibArchive) C:UsersxxxDesktophiPyuildhiPYZ-00.pyz completed successfully.
3595 INFO: checking PKG
3596 INFO: Building PKG because PKG-00.toc is non existent
3596 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
(... 略去无关信息 ...)
File "C:UsersxxxAppDataLocalProgramsPythonPython37lib
tpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
排查
- 尝试新建空白项目排除与源码状况有关
- 尝试不使用venv发现一切正常
解决
python3.7版本的venv机制与pyinstaller某些实现有冲突,请采用virtualenv创建虚拟环境。目前并不清楚是否是windows平台特有