PyInstaller的问题 [英] Problems with PyInstaller

查看:84
本文介绍了PyInstaller的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PyInstaller将应用程序捆绑为可执行文件.由于geopandas库,我遇到了问题.目前,我的脚本throwaway.py仅包含以下导入:

I would like to bundle an application into an executable using PyInstaller. I am having issues because of the geopandas library. Currently my script throwaway.py contains only the following import:

import geopandas

但是,运行pyinstaller throwaway.py无效.似乎只有matplotlib导入的PyQt5有问题.

However running pyinstaller throwaway.py does not work. It appears to have problems with PyQt5 which only matplotlib imports.

pyinstaller的日志太长,无法在此处包含,但是以下显示了遇到的最后一个异常:

The log for pyinstalleris too long to include here however the following shows the last exception encountered:

Exception:
            Cannot find existing PyQt5 plugin directories
            Paths checked: c:/qt/qt_1489878162099/_b_env/Library/plugins

我不确定该如何处理,但是有两个概念上的选择:

I am not sure how to approach this, but there are a couple of conceptual options:

  • 找到一种排除matplotlib导入geopandas的方法.我没有使用matplotlib,所以我真的不需要首先打包它.
  • 弄清楚为什么会出现此问题,并预防/解决此问题

有人可以帮忙吗?非常感谢!

Could anyone please help? Thanks a lot!

推荐答案

我通过下载pyinstaller的开发版本来解决此问题,如下所示:

I solved this problem by downloading the development version of pyinstaller as follows:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

我从此链接中获得了以上内容. pyinstaller的当前conda-forge发行版仍不包含

I got the above from this link. The current conda-forge distribution of pyinstaller still does not include this change which is included in the development version. The code prior to that change is what was causing the error in the question to occur.

希望conda-forge发行版很快就会将其合并到主发行版中.

Hopefully the conda-forge distribution will soon come to incorporate this into the main distribution.

因此,基本上,如果您遇到此问题,则有两种选择:

So basically if you are experiencing this problem you have two choices:

  • Install development version of PyInstaller and use that
  • Manually go inside the ~\anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.py and modify the file as indicated here

这篇关于PyInstaller的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆