简体   繁体   English

ModuleNotFoundError:PyInstaller 没有名为“sklearn.neighbors._partition_nodes”的模块

[英]ModuleNotFoundError: No module named 'sklearn.neighbors._partition_nodes' with PyInstaller

I have been trying to build a Windows executable from Python files using PyInstaller (and auto-py-to-exe, but the problem really resides with PyInstaller).我一直在尝试使用 PyInstaller(和 auto-py-to-exe,但问题确实在于 PyInstaller)从 Python 文件构建一个 Windows 可执行文件。 Once the executable is built (using --onedir), I try to launch it and it crashes with this error message:构建可执行文件后(使用 --onedir),我尝试启动它,但它崩溃并显示以下错误消息:

  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\feature_selection\__init__.py", line 28, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\feature_selection\_mutual_info.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\neighbors\__init__.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1050, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "sklearn\neighbors\_ball_tree.pyx", line 1, in init sklearn.neighbors._ball_tree
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sklearn.neighbors._partition_nodes'
[17176] Failed to execute script 'Make_Model' due to unhandled exception!

I have tried to add sklearn.neighbors._partition_nodes to the hidden imports list, but I still obtain the same error message.我试图将 sklearn.neighbors._partition_nodes 添加到隐藏的导入列表中,但我仍然收到相同的错误消息。 I have looked at the very helpful auto-py-to-exe page and the not-as-helpful PyInstaller page, but nothing specific to my problem can be found.我查看了非常有用的 auto-py-to-exe页面和没有帮助的PyInstaller页面,但没有找到针对我的问题的任何内容。

I know that scikit-learn is notoriously difficult to deal with when it comes to PyInstaller, but can anybody provide some guidance about this problem?我知道 scikit-learn 对于 PyInstaller 来说是出了名的难处理,但是有人可以提供一些关于这个问题的指导吗?

In case someone asks, the code is written in Python 3.7.11 in a Windows 10 environment.万一有人问,代码写在Windows 10环境下的Python 3.7.11。

I managed to resolve this by doing what sometimes is the best solution: I deleted all my previous attempts at building the executable and re-started afresh using solely auto-py-to-exe.我设法通过做有时是最好的解决方案来解决这个问题:我删除了之前构建可执行文件的所有尝试,并仅使用 auto-py-to-exe 重新启动。 This time, adding sklearn.neighbors._partition_nodes to the hidden import list worked.这一次,将 sklearn.neighbors._partition_nodes 添加到隐藏的导入列表中。 I was then able to move on to the next problem (XGBoost), but there are plenty of answers available for that.然后我能够继续下一个问题 (XGBoost),但是有很多答案可以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pyinstaller和sklearn.ensemble:&#39;ModuleNotFoundError:没有名为&#39;sklearn.neighbors.quad_tree&#39;的模块[2760]&#39; - Pyinstaller and sklearn.ensemble: 'ModuleNotFoundError: No module named 'sklearn.neighbors.quad_tree' [2760]' ModuleNotFoundError:没有名为“sklearn.neighbors._dist_metrics”的模块 - ModuleNotFoundError: No module named 'sklearn.neighbors._dist_metrics' 安装程序; ModuleNotFoundError:没有名为“sklearn.utils._cython_blas”的模块 - Pyinstaller ; ModuleNotFoundError: No module named 'sklearn.utils._cython_blas' modulenotfounderror:没有名为“ sklearn”的模块 - modulenotfounderror : no module named 'sklearn' ModuleNotFoundError:没有名为“sklearn”的模块 - ModuleNotFoundError: No module named 'sklearn' PyInstaller:ModuleNotFoundError:没有名为“编码”的模块 - PyInstaller: ModuleNotFoundError: No module named 'encodings' pyinstaller ModuleNotFoundError:没有名为“桨”的模块 - pyinstaller ModuleNotFoundError: No module named 'paddle' Pyinstaller - ModuleNotFoundError:没有名为“cpuinfo”的模块 - Pyinstaller - ModuleNotFoundError: No module named 'cpuinfo' ModuleNotFoundError:没有名为“sklearn”的模块 python - ModuleNotFoundError: No module named 'sklearn' python 没有名为“sklearn.neighbors._base”的模块 - No module named 'sklearn.neighbors._base'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM