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

相關文章
相關標籤/搜索