天天看點

pyinstaller打包報錯:expected str, bytes or os.PathLike object, not NoneType

修複pyinstaller打包報錯

環境:win10,PyCharm 2019.1.1 x64 ,phthon3.7,pyinstaller3.4

想使用pyinstaller打包釋出成exe,報錯

TypeError: expected str, bytes or os.PathLike object, not NoneType

解決方法是找到項目根目錄下\venv\Lib\site-packages\PyInstaller\depend\bindepend.py這個檔案打開修改,

搜尋“Applies only to non Windows platforms”,在後面添加

if is_win and ‘VERSION.dll’ in dlls:

pydll = ‘python%d%d.dll’ % sys.version_info[:2]

if pydll in PYDYLIB_NAMES:

filename = getfullnameof(pydll)

return filename

插入代碼後如下圖

pyinstaller打包報錯:expected str, bytes or os.PathLike object, not NoneType

嫌麻煩的同學可以點這裡下載下傳替換bindepend.py