在cmd模式下,进入py文件所在目录,然后使用pyinstaller打包exe,但是一直出现错误,ValueError: Can't mix absolute and relative paths,求助大佬们 h:\xxx>pyinstaller -F a.py 280 INFO: PyInstaller: 4.0.dev0+c6a74f060e 280 INFO: Python: 3.8.2 284 INFO: Platform: Windows-10-10.0.18362-SP0 Traceback (most recent call last): File "e:\python\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "e:\python\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "E:\python\Scripts\pyinstaller.exe\__main__.py", line 7, in <module> File "e:\python\lib\site-packages\PyInstaller\__main__.py", line 112, in run spec_file = run_makespec(**vars(args)) File "e:\python\lib\site-packages\PyInstaller\__main__.py", line 58, in run_makespec spec_file = PyInstaller.building.makespec.main(filenames, **opts) File "e:\python\lib\site-packages\PyInstaller\building\makespec.py", line 458, in main specfile.write(onefiletmplt % d) File "e:\python\lib\site-packages\PyInstaller\building\makespec.py", line 101, in __repr__ self.variable_prefix, self.filename_suffix = make_variable_path(self.path) File "e:\python\lib\site-packages\PyInstaller\building\makespec.py", line 84, in make_variable_path if os.path.commonpath([filename, from_path]) == from_path: File "e:\python\lib\ntpath.py", line 757, in commonpath raise ValueError("Can't mix absolute and relative paths") from None ValueError: Can't mix absolute and relative paths
https://hxhen.com/python-os-path-model/
好像是不能相对路径和绝对路径混合使用
pyinstaller -F a.py
里面的a.py 改为绝对路径试一下
一样是这个错误,已经找到问题了,是因为使用pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz下载pyinstaller库,导致下载了最新的4.0?反正就是出现了PyInstaller-4.0.dev0+c6a74f060e.dist-info文件。。。然后就无法使用了,卸载再重新使用pip install pyinstaller安装就可以了