获取当前脚本路径问题
# determine if application is a script file or frozen exe
if getattr(sys, 'frozen', False):
PATH_CUR = os.path.dirname(sys.executable)
elif __file__:
PATH_CUR = os.path.dirname(__file__)
pyinstaller打包exe报错UnicodeDecodeError:’ascii’ codec can’t decode
因为pyinstaller打包的文件路劲中带有中文。
pyInstall仅支持ascii编码方式,打包后可执行文件路径中不能有中文。
pyinstaller打包exe时subprocess无效
打包包含subprocess.Popen时发现,加上参数-w/—noconsole时产生的exe文件在运行的时候,进程并没有运行。
解决方法:
在创建进程时,加上startupinfo参数,如下