我正在尝试使用 pyinstaller 创建单个可执行文件以分发给未安装 Python 的用户.
I am trying to use pyinstaller to create a single executable to distribute to users without Python installed.
该脚本非常简单,只是为了试水,我只使用了几行代码作为豚鼠".
The script is a very simple one and just to test waters I'm using just a few lines of code as "Guinea Pig".
Hello World 程序 - 没有导入,转换良好.
The Hello World program - no imports, converts fine.
导入 matplotlib.pyplot 并绘制值列表的豚鼠程序失败了.
My Guinea Pig program, which imports matplotlib.pyplot and plots a list of values, fails.
该问题是已知的并记录在此处,尽管他们声称已修复,或者也许我无法正确阅读.我认为修复应该在开发版本"中可用,应该是 3.2.1,我已经通过 pip install --upgrade pyinstaller 安装,但无济于事.
The issue is known and documented here, although they claim it is fixed, or maybe I can't read correctly. I think the fix should be available in the "dev version" which should be 3.2.1, and I have installed through pip install --upgrade pyinstaller, to no avail.
我不断收到相同的语法错误,这是在阅读
I keep getting the same syntax error, which occurs when reading the
module jinja2\asyncsupport.py知道如何解决这个问题吗?我的项目非常简单,它只涉及matplotlib、pandas、读取文件和绘制一些数据.
Any idea how to work around this? My project is ultra simple and it just involves matplotlib, pandas, reading a file and plotting some data.
推荐答案我遇到了同样的错误.
原因是 Jinja2 在 2.9 版本中为 Python3.6 添加了新的异步函数.
The reason is Jinja2 added new async function for Python3.6 in version 2.9.
请参阅jinja.pocoo/docs/2.9/changelog/#version-2-9-6
有两种方法可以避免此错误.这两个都对我有用.
There are two ways to avoid this error. Both of these worked for me.
降级 jinja2
Downgrade jinja2 # using Anaconda conda install jinja2=2.8.1 # using pip pip install jinja2==2.8.1
安装开发版的 PyInstaller
Install dev version of PyInstaller
# install from github # Don't run "pip install -U pyinstaller" because the dev version is not released yet pip install git+github/pyinstaller/pyinstaller.git # check if "PyInstaller (3.3.dev0+g483dfde)" is in the list pip list更多推荐
Pyinstaller 语法错误:异步函数中的“yield"(Python 3.5.1)
发布评论