这是我所有的代码
import pyglet
import ratcave as rc
window = pyglet.window.Window()
pyglet.app.run()
当运行此程序时,在终端中显示以下内容
Traceback (most recent call last):
File "c:\CODING\pyopengl\Mudge-David-Homework-8.py", line 14, in <module>
import ratcave as rc
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\resources.py", line 40, in <module>
default_camera = Camera()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 260, in __init__
self.projection = PerspectiveProjection() if not projection else projection
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 56, in __setattr__
super(AutoRegisterObserver, self).__setattr__(key, value)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 299, in projection
self.reset_uniforms()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 302, in reset_uniforms
self.uniforms['projection_matrix'] = self.projection_matrix.view()
PS C:\Users\David> & C:/Users/David/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/CODING/pyopengl/Mudge-David-Homework-8.py
Traceback (most recent call last):
File "c:\CODING\pyopengl\Mudge-David-Homework-8.py", line 14, in <module>
import ratcave as rc
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\resources.py", line 40, in <module>
default_camera = Camera()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 260, in __init__
self.projection = PerspectiveProjection() if not projection else projection
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 56, in __setattr__
super(AutoRegisterObserver, self).__setattr__(key, value)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 299, in projection
self.reset_uniforms()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\camera.py", line 302, in reset_uniforms
self.uniforms['projection_matrix'] = self.projection_matrix.view()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\shader.py", line 139, in uniforms
self.update()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\utils\observers.py", line 47, in update
self.on_change()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\physical.py", line 186, in on_change
Physical.on_change(self)
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\physical.py", line 138, in on_change
self.model_matrix = np.dot(self.position.to_matrix(), self.rotation.to_matrix())
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\coordinates.py", line 126, in to_matrix
return self.to_radians().to_matrix()
File "C:\Users\David\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ratcave\coordinates.py", line 95, in to_matrix
mat[:3, :3] = R.from_euler(self.axes[1:],self._array,degrees=False).as_dcm() # scipy as_matrix() not available
AttributeError: 'scipy.spatial.transform._rotation.Rotation' object has no attribute 'as_dcm'
看起来错误是最后一行AttributeError:'scipy.spatial.transform._rotation.旋转'对象没有属性'as_dcm'
代码应该创建一个新窗口,这反过来意味着Pyglet正在工作。
根据我的研究,这个问题已经通过改变SciPy方法得到了解决,我已经尝试过了,但没有成功。这个问题的另一个线程通过安装正确的版本解决了这个问题,这将纠正这些方法。然而,我已经尝试安装不同版本的SciPy,仍然得到同样的错误。
1条答案
按热度按时间ru9i0ody1#
Rotation
类的as_dcm()
方法在SciPy 1.4.0版中已弃用,并已从SciPy 1.6.0版中删除。您必须使用较旧版本的SciPy,或查明是否有可与最新版本的SciPy配合使用的ratcave
版本。