我使用:pyinstaller main.py
Traceback (most recent call last):
File "C:\Users\koksem1234\PycharmProjects\untitled\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 29, in <module>
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\api.py", line 424, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\api.py", line 196, in __init__
self.__postinit__()
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "C:\Users\koksem1234\PycharmProjects\untitled\lib\site-packages\PyInstaller\building\api.py", line 273, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "C:\Users\koksem1234\AppData\Local\Programs\Python\Python37-32\lib\ntpath.py", line 214, in basename
return split(p)[1]
File "C:\Users\koksem1234\AppData\Local\Programs\Python\Python37-32\lib\ntpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
答案 0 :(得分:0)
看起来您正在向os.fspath()传递一个空变量或在某处“无”。
如果您传递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