如何修复“‘pathlib’包是标准库包的过时向后移植,并且与 PyInstaller 不兼容”?

aza*_*a01 3 python pyinstaller anaconda conda

我正在使用Python 3.9.16。当我尝试构建这样的应用程序时:

(base) G:\>pyinstaller --onefile grp.py
Run Code Online (Sandbox Code Playgroud)

我收到一条错误消息:

The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in C:\Users\alpha\anaconda3\lib\site-packages) using conda remove then try again.
Run Code Online (Sandbox Code Playgroud)

我尝试卸载并重新安装 pyinstaller,以及升级 conda,但这些都没有帮助。

我该如何解决这个问题?

小智 10

尝试将 pyInstaller 降级到 5.1(从 5.8)。那么就没有必要删除pathlib。