AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'

AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'

我为卷积神经网络创建了一个 tkinter 应用程序来识别图像。我正在尝试使用 pyinstaller 编译 py 文件,但我收到此错误:

AttributeError: 类型对象 'pandas._libs.tslib._TSObject' 没有属性'_reduce_cython_'

我也附上错误的截图

我用

解决了
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas myScript.py 

现在可以使用了

当我尝试为未完成的项目创建一个应用程序以进行测试时,我遇到了这个问题。

我已经 pandas 导入了,但我没有在我的脚本中调用它。

删除导入行或调用 pandas 是解决方案。

如果您使用的是 Jupyter notebook,请重新启动。它对我有用。还要确保您在正确的 python 环境中工作。

你也需要有 cython,

  1. pip install cythonconda install cython

  2. pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas program.py

其他解决方案对我不起作用,但有效的是:

  1. conftest.py
  2. 的最顶部添加 import pandas
  3. ignore:numpy\.ufunc size changed.+:RuntimeWarning添加到pytest.ini
  4. filterwarnings选项
  5. 升级freezegun到最新版本