TypeError: 'NoneType' object is not callable running exe made with pyinstaller

TypeError: 'NoneType' object is not callable running exe made with pyinstaller

当尝试 运行 我使用 pyinstaller 制作的 exe 文件时,它在导入 OpenGL 时失败并带有此回溯:

(env) C:\Users\me\myProject>.\dist\myProject\myProject.exe
Traceback (most recent call last):
  File "main.py", line 6, in <module>
    from igtools import IG
  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 476, in exec_module
  File "OpenGL\GL\__init__.py", line 3, 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 476, in exec_module
  File "OpenGL\error.py", line 12, 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 476, in exec_module
  File "OpenGL\platform\__init__.py", line 36, in <module>
  File "OpenGL\platform\__init__.py", line 30, in _load
TypeError: 'NoneType' object is not callable
[38272] Failed to execute script 'main' due to unhandled exception!

所以我不确定到底是什么问题。它似乎与我不完全理解的 pyinstaller 挂钩有关,但我确实让它与发行版本的这种特定组合一起工作:

pyinstaller==4.0
pyinstaller-hooks-contrib==2020.9
PyOpenGL==3.1.5

如果其他人遇到此问题,这可能会有所帮助。