【问题标题】:Getting error with Scikits-Learn RandonForest trained in 64bit and opening in 64bit PyCharm在 64 位中训练并在 64 位 PyCharm 中打开的 Scikit-Learn 随机森林出现错误
【发布时间】:2021-03-04 23:02:43
【问题描述】:

我在 Jupyter Notebook 64bit 中创建了一个 RandomForestClassifier 模型。我腌制它以将其加载到 PyCharm 64bit 中,尝试运行我的 python 程序时出现以下错误:

Traceback (most recent call last):
  File "C:/Users/Justin/Desktop/C964/Thyroid_DX_PC/main.py", line 11, in <module>
    clf_model = pickle.load(open("clf_model.pkl", "rb"))
  File "sklearn\tree\_tree.pyx", line 607, in sklearn.tree._tree.Tree.__cinit__
ValueError: Buffer dtype mismatch, expected 'SIZE_t' but got 'long long'

我可以确认 Jupyter 和 PyCharm 都在运行 64 位 Python。我可以在网上找到这个错误的唯一原因是这种不匹配,所以我完全迷路了。谢谢!

【问题讨论】:

  • Jupyter Notebook 和 PyCharm 是否使用相同版本的 Python? import ctypes ; print (ctypes.sizeof(ctypes.c_voidp)) 在每个中显示什么?
  • Jupyter notebook 输出为 8,PyCharm 为 4。Juptyer Notebook 运行 Python 3.8.5。我刚刚重新下载了 Pycharm。我的解释器设置为 Python 3.7。非常感谢您的帮助!!

标签: python scikit-learn


【解决方案1】:

虽然我的 Conda/Jupyter Notebook 和 PyCharm 是 64 位的,但我的 python 不是 64 位的。它是 32 位的。我升级到64位,情况就解决了。

【讨论】:

    猜你喜欢
    • 2014-01-28
    • 2016-05-27
    • 2019-02-13
    • 2013-04-26
    • 2015-03-28
    • 2015-02-20
    • 2015-04-13
    • 2015-03-31
    • 2016-06-22
    相关资源
    最近更新 更多