系统版本:Windows7 企业版 64bit
Python版本:python3.7
安装pyinstaller:
pip3 install pyinstaller
安装可以成功。可以使用pyinstaller验证是否可以正常工作。若在cmd下不能正常打开,可以在cmd下进入到对应的目录,然后再启动pyinstaller,这样就可以正常使用了。
打包的命令为:pyinstaller -F xxx.py。这样就可以生成对应的xxx.exe文件(存放目录在dist文件夹中)。
发现生成的xxx.exe文件在运行时异常。(xxx为文件名称,根据个人文件而定)
错误代码:
Fatal Python error: initfsencoding: unable to load the file system codec
zipimport.ZipImportError: can't find module 'encodings'
对上面错误进行分析查找,发现是pyinstaller还不支持python3.7,所以需要安装新版本的。
新安装命令如下:pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
可能在后期,pyinstaller会自动支持python3.7,也就不用再采用第二个命令进行安装了。。。