PyInstaller 的问题
Problems with PyInstaller
我想使用 PyInstaller 将应用程序捆绑到可执行文件中。由于 geopandas
库,我遇到了问题。目前我的脚本 throwaway.py
仅包含以下导入:
import geopandas
但是运行pyinstaller throwaway.py
不起作用。 PyQt5
似乎有问题,只有 matplotlib
导入。
pyinstaller
的日志太长,无法包含在此处,但以下显示了最后遇到的异常:
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: c:/qt/qt_1489878162099/_b_env/Library/plugins
我不确定如何处理这个问题,但有几个概念性的选择:
- 找到一种方法来排除 matplotlib 的 geopandas 导入。我没有使用 matplotlib,所以我真的不需要首先打包它
- 找出出现此问题的原因并prevent/fix它
有人可以帮忙吗?非常感谢!
这个 pyinstaller -y -d --clean throwaway.py
适合我。
此外,检查这个 。
here 指出递归限制存在问题。
尝试像这样增加它:
import sys
sys.setrecursionlimit(5000)
我通过下载pyinstaller
开发版解决了这个问题,如下:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
我从 this link. The current conda-forge
distribution of pyinstaller
still does not include this change 得到了上面的内容,它包含在开发版本中。该更改之前的代码是导致问题中出现错误的原因。
希望 conda-forge
发行版很快将其合并到主要发行版中。
所以基本上,如果您遇到这个问题,您有两个选择:
- 安装 PyInstaller 的开发版本并使用它
- 手动进入
~\anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.py
并按照指示修改文件 here
我想使用 PyInstaller 将应用程序捆绑到可执行文件中。由于 geopandas
库,我遇到了问题。目前我的脚本 throwaway.py
仅包含以下导入:
import geopandas
但是运行pyinstaller throwaway.py
不起作用。 PyQt5
似乎有问题,只有 matplotlib
导入。
pyinstaller
的日志太长,无法包含在此处,但以下显示了最后遇到的异常:
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: c:/qt/qt_1489878162099/_b_env/Library/plugins
我不确定如何处理这个问题,但有几个概念性的选择:
- 找到一种方法来排除 matplotlib 的 geopandas 导入。我没有使用 matplotlib,所以我真的不需要首先打包它
- 找出出现此问题的原因并prevent/fix它
有人可以帮忙吗?非常感谢!
这个 pyinstaller -y -d --clean throwaway.py
适合我。
此外,检查这个
here 指出递归限制存在问题。 尝试像这样增加它:
import sys
sys.setrecursionlimit(5000)
我通过下载pyinstaller
开发版解决了这个问题,如下:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
我从 this link. The current conda-forge
distribution of pyinstaller
still does not include this change 得到了上面的内容,它包含在开发版本中。该更改之前的代码是导致问题中出现错误的原因。
希望 conda-forge
发行版很快将其合并到主要发行版中。
所以基本上,如果您遇到这个问题,您有两个选择:
- 安装 PyInstaller 的开发版本并使用它
- 手动进入
~\anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.py
并按照指示修改文件 here