使用pyinstaller打包时出现路径混合错误 :Can't mix absolute and relative paths ,请问该如何解决?

编程小白求教,问题如下:

Microsoft Windows [版本 10.0.18362.720]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\cheung>E:

E:\>cd kochdraw

E:\kochdraw>dir
 驱动器 E 中的卷是 新加卷
 卷的序列号是 A213-E20B

 E:\kochdraw 的目录

20/04/14  20:10    <DIR>          .
20/04/14  20:10    <DIR>          ..
20/04/13  22:53               469 kochdraw.py
12/04/12  15:56            99,678 picture.ico
               2 个文件        100,147 字节
               2 个目录 106,903,748,608 可用字节

E:\kochdraw>pyinstaller -i picture.ico -F kochdraw.py
165 INFO: PyInstaller: 4.0.dev0+b3dd91c8a8
165 INFO: Python: 3.8.1
167 INFO: Platform: Windows-10-10.0.18362-SP0
Traceback (most recent call last):
  File "d:\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "D:\Python38\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "d:\python38\lib\site-packages\PyInstaller\__main__.py", line 112, in run
    spec_file = run_makespec(**vars(args))
  File "d:\python38\lib\site-packages\PyInstaller\__main__.py", line 58, in run_makespec
    spec_file = PyInstaller.building.makespec.main(filenames, **opts)
  File "d:\python38\lib\site-packages\PyInstaller\building\makespec.py", line 458, in main
    specfile.write(onefiletmplt % d)
  File "d:\python38\lib\site-packages\PyInstaller\building\makespec.py", line 101, in __repr__
    self.variable_prefix, self.filename_suffix = make_variable_path(self.path)
  File "d:\python38\lib\site-packages\PyInstaller\building\makespec.py", line 84, in make_variable_path
    if os.path.commonpath([filename, from_path]) == from_path:
  File "d:\python38\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

1个回答

使用绝对路径,如C:(路径)\kochdraw.py

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问