无法使用 pycharm 创建 exe,因为它抱怨钟摆区域设置

Can't create exe with pycharm as it complains pendulum locales

我有一个 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 中的挂钩的帖子,但 none 这些工作。

https://github.com/pyinstaller/pyinstaller/issues/3528

我真的不想删除 orator,因为我经常使用 Laravel,而且 orator 接近我熟悉的优秀 Eloquent。有没有办法让 pyinstaller 在 pendulum 1.4 上工作?

更新

改变

datas = collect_data_files("pendulum.locales", include_py_files=True)

在站点 Packages/Pyinstalller/hooks/hook-pendulum.py 到

datas = collect_data_files("pendulum", include_py_files=True)

似乎成功了。

还不打算将此标记为答案,因为我不确定这是否会导致问题。

这已经解决了我的问题,并且已经投入生产超过 50 天,没有任何问题,所以我现在将其标记为已回答。虽然这解决了我的问题,但在某些情况下删除“.locales”可能会破坏某些内容,因此请始终牢记这一点。