我有一个GUI应用程序,它不会打包到与pyinstaller的exe。当我运行pyinstaller main.py --onefile --windowed时,我得到以下错误。
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'pendulum.locales'我将pendulum从1.4更新到2.0.5,然后exe构建得很好。但是,这将不会运行。我重新运行了不带--windowed标志的pyinstaller,然后可以看到我正在使用的ORM (orator)与> 1.4的pendulum不兼容,并且无法从pendulum导入Pendulum。
from pendulum import Pendulum, Date
ImportError: cannot import name 'Pendulum' from 'pendulum' (C:\Users\Paul\PycharmProjects\JobsV10\venv\lib\site-packages\pendulum\__init__.py)我试过在下面的帖子中更改pyinstaller中的钩子,但这些都不起作用。
https://github.com/pyinstaller/pyinstaller/issues/3528
我真的不想删除演说者,因为我经常使用Laravel,而且演说者接近我所熟悉的优秀的雄辩能力。有没有办法让pyinstaller在pendulum 1.4下工作?
更新
改变
datas = collect_data_files("pendulum.locales", include_py_files=True)在站点Packages/Pyinstalller/hooks/hook-chenulum.py中
datas = collect_data_files("pendulum", include_py_files=True)看起来已经成功了。
我还不打算将此标记为答案,因为我不确定这是否会导致问题。
发布于 2019-10-02 22:44:51
这已经解决了我的问题,并且已经投入生产超过50天,没有任何问题,所以我现在将其标记为已回答。虽然这解决了我的问题,但删除'.locales‘在某些情况下可能会破坏某些东西,所以请始终牢记这一点。
https://stackoverflow.com/questions/57616144
复制相似问题