属性错误:模块“glm”没有属性“perspective”

问题描述 投票:0回答:1

我不知道发生了什么

我认为它会起作用,因为它适用于除此 pygame 2.5.2 之外的所有其他计算机(SDL 2.28.3,Python 3.11.7) 来自 pygame 社区的您好。 https://www.pygame.org/contribute.html

Traceback (most recent call last):
  File "c:\Users\Dell\Desktop\projects\OPEN3D\main.py", line 40, in <module>
          ^^^^^^^^^^^^^^^^
  File "c:\Users\Dell\Desktop\projects\OPEN3D\main.py", line 19, in __init__
    self.camera = Camera(self)
                  ^^^^^^^^^^^^
  File "c:\Users\Dell\Desktop\projects\OPEN3D\camera.py", line 11, in __init__
    self.m_proj = self.get_projection_matrix()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Dell\Desktop\projects\OPEN3D\camera.py", line 13, in get_projection_matrix
    return glm.perspective(glm.radians(FOV),self.aspect_ratio,Near,Far)
           ^^^^^^^^^^^^^^^
AttributeError: module 'glm' has no attribute 'perspective'
PS C:\Users\Dell\Desktop\projects>  c:; cd 'c:\Users\Dell\Desktop\projects'; & 'c:\Users\Dell\AppData\Local\Microsoft\WindowsApps\python3.11.exe' 'c:\Users\Dell\.vscode\extensions\ms-python.debugpy-2023.3.13341008-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '58277' '--' 'C:\Users\Dell\Desktop\projects\OPEN3D\main.py'

请任何人帮助我

python attributeerror
1个回答
0
投票

这可能是因为您已经下载并安装了 glm - 这是一个不同的库,而不是 PyGLM。

所以尝试卸载glm:

pip uninstall glm

并尝试安装 PyGLM:

pip install numpy PyGLM
© www.soinside.com 2019 - 2024. All rights reserved.