我不知道为什么当我想将PY转换为Exe Pyinstaller不起作用时



i使用:pyinstaller main.py

Traceback (most recent call last):
  File "C:Userskoksem1234PycharmProjectsuntitledScriptspyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstaller__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstaller__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingbuild_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingbuild_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 29, in <module>
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingapi.py", line 424, in __init__
    strip_binaries=self.strip, upx_binaries=self.upx,
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingapi.py", line 196, in __init__
    self.__postinit__()
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingdatastruct.py", line 158, in __postinit__
    self.assemble()
  File "C:Userskoksem1234PycharmProjectsuntitledlibsite-packagesPyInstallerbuildingapi.py", line 273, in assemble
    pylib_name = os.path.basename(bindepend.get_python_library_path())
  File "C:Userskoksem1234AppDataLocalProgramsPythonPython37-32libntpath.py", line 214, in basename
    return split(p)[1]
  File "C:Userskoksem1234AppDataLocalProgramsPythonPython37-32libntpath.py", line 183, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

看起来您正在通过OS.fspath()一个空变量或'none'某个地方。

如果您通过os.fspath()一个字符串,则将其返回不变。

否则 __fspath__()被调用,只要它是字符串或字节对象,就会返回其值。在所有其他情况下,TypeError都会升高..

>>> os.fspath("C:/USERS/")
'C:/USERS/'
>>> os.fspath(10)  #won't take INT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected str, bytes or os.PathLike object, not int
>>> os.fspath(None)  #nor will it take 'None'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected str, bytes or os.PathLike object, not NoneType

最新更新