Pyinstaller语法错误:异步函数内的'yield'(Python 3.5.1)

Mic*_*cis 8 pyinstaller

我试图用来pyinstaller创建一个可执行文件,以分发给没有安装Python的用户.

脚本是一个非常简单的脚本,只是为了测试水域,我只使用几行代码作为"豚鼠".

Hello World计划 - 没有进口,转换良好.

导入matplotlib.pyplot并绘制值列表的我的豚鼠程序失败了.

这个问题在这里是已知和记录的,虽然他们声称它是固定的,或者我可能无法正确阅读.我认为应该在"dev版本"中提供修复程序,该版本应该是3.2.1,并且我已安装通过pip install --upgrade pyinstaller,但无济于事.

我一直得到相同的语法错误,这在读取时会发生

module jinja2\asyncsupport.py
Run Code Online (Sandbox Code Playgroud)

知道如何解决这个问题吗?我的项目是超简单的,它只是涉及matplotlib,pandas,读取文件,并绘制了一些数据.

小智 12

我得到了同样的错误.

原因是Jinja2在2.9版本中为Python3.6添加了新的异步函数.

请参阅http://jinja.pocoo.org/docs/2.9/changelog/#version-2-9-6

有两种方法可以避免此错误.这两个都适合我.

  1. 降级jinja2

       # using Anaconda
       conda install jinja2=2.8.1
    
       # using pip
       pip install jinja2==2.8.1
    
    Run Code Online (Sandbox Code Playgroud)
  2. 安装开发版的PyInstaller

      # install from github
      # Don't run "pip install -U pyinstaller" because the dev version is not released yet
      pip install git+https://github.com/pyinstaller/pyinstaller.git
    
      # check if "PyInstaller (3.3.dev0+g483dfde)" is in the list
      pip list
    
    Run Code Online (Sandbox Code Playgroud)