Pyinstaller封裝exe-TypeError: expected str, bytes or os.PathLike object, not NoneType

用Pyinstaller封裝exe時出現錯誤:TypeError: expected str, bytes or os.PathLike object, not NoneType

環境: Ubuntu 16  python3.6 

58477 INFO: Loading module hook "hook-gevent.monkey.py"...
58612 INFO: Looking for ctypes DLLs
58982 WARNING: library user32 required via ctypes not found
59330 INFO: Analyzing run-time hooks ...
59365 INFO: Including run-time hook 'pyi_rth__tkinter.py'
59367 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
59370 INFO: Including run-time hook 'pyi_rth_pkgres.py'
59371 INFO: Including run-time hook 'pyi_rth_traitlets.py'
59372 INFO: Including run-time hook 'pyi_rth_qt5.py'
59373 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
59374 INFO: Including run-time hook 'pyi_rth_mpldata.py'
59437 INFO: Looking for dynamic libraries
63980 INFO: Looking for eggs
63980 INFO: Using Python library ~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/scipy/linalg/../../../../libpython3.6m.so.1.0
64015 INFO: Warnings written to ~/build/__init__/warn__init__.txt
64298 INFO: Graph cross-reference written to ~/build/__init__/xref-__init__.html
64447 INFO: checking PYZ
64447 INFO: Building PYZ because out00-PYZ.toc is non existent
64447 INFO: Building PYZ (ZlibArchive) ~/build/__init__/out00-PYZ.pyz
67927 INFO: Building PYZ (ZlibArchive) ~/build/__init__/out00-PYZ.pyz completed successfully.
68011 INFO: checking PKG
68011 INFO: Building PKG because out00-PKG.toc is non existent
68011 INFO: Building PKG (CArchive) out00-PKG.pkg
Traceback (most recent call last):
  File "~/Softwares/anaconda3/5.0.0/bin/pyinstaller", line 11, in <module>
    load_entry_point('PyInstaller==3.4.dev0+2611919ba', 'console_scripts', 'pyinstaller')()
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 26, in <module>
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/api.py", line 411, in __init__
    strip_binaries=self.strip, upx_binaries=self.upx,
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/api.py", line 196, in __init__
    self.__postinit__()
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
    self.assemble()
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/site-packages/PyInstaller/building/api.py", line 273, in assemble
    pylib_name = os.path.basename(bindepend.get_python_library_path())
  File "~/Softwares/anaconda3/5.0.0/lib/python3.6/posixpath.py", line 144, in basename
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

解決辦法:將路徑加入到系統變量中

找到對應的路徑,比如上述的就是~/Softwares/anaconda3/5.0.0/lib,因此對應的路徑添加就是:

LD_LIBRARY_PATH=~/Softwares/anaconda3/5.0.0/lib pyinstaller

打開  .bashrc文件  gedit ~/.bashrc

t添加上述語句,然後直接使能就可以

source ~/.bashrc

 

轉載博客:https://blog.csdn.net/LYKXHTP/article/details/82157039

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章