运行下面代码的时候出现以上错误 pyinstaller test.spec 问题出在spec文件里面的pathex处。没正确填写。 解决办法: 找到这个spec文件,修改pathex如下。 即: 将main入口的文件所在绝对路径添加到pathex处。 比如我的test.py是main入口,所在目录为D:\project,那么就设置pathex为 pathex=['D:\\project']