windows下python3.7.2内置venv虚拟环境下pyinstaller错误问题

原由

开发一直使用python -m venv .pyenv 方式建立虚拟环境,在利用pyinstaller打包发布应用时,出现错误html

3178 INFO: Warnings written to C:\Users\xxx\Desktop\hiPy\build\hi\warn-hi.txt
3203 INFO: Graph cross-reference written to C:\Users\xxx\Desktop\hiPy\build\hi\xref-hi.html
3295 INFO: checking PYZ
3295 INFO: Building PYZ because PYZ-00.toc is non existent
3297 INFO: Building PYZ (ZlibArchive) C:\Users\xxx\Desktop\hiPy\build\hi\PYZ-00.pyz
3587 INFO: Building PYZ (ZlibArchive) C:\Users\xxx\Desktop\hiPy\build\hi\PYZ-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:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\ntpath.py", line 183, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

排查

  1. 尝试新建空白项目排除与源码情况有关
  2. 尝试不使用venv发现一切正常

解决

python3.7版本的venv机制与pyinstaller某些实现有冲突,请采用virtualenv建立虚拟环境。目前并不清楚是不是windows平台特有python

相关文章
相关标签/搜索