File "E:\anaconda\lib\site-packages\gym\envs\classic_control\rendering.py", line 96, in render self.transform.enable() File "E:\anaconda\lib\site-packages\gym\envs\classic_control\rendering.py", line 190, in enable glPushMatrix() File "E:\anaconda\lib\site-packages\OpenGL\platform\baseplatform.py", line 415, in __call__ return self( *args, **named ) File "E:\anaconda\lib\site-packages\OpenGL\error.py", line 230, in glCheckError raise self._errorClass( OpenGL.error.GLError: GLError( err = 1282, description = b'\xce\xde\xd0\xa7\xb2\xd9\xd7\xf7', baseOperation = glPushMatrix, cArguments = () ) Exception ignored in: <function Viewer.__del__ at 0x00000268D50180D0>
时间: 2023-07-11 15:58:45 浏览: 189
这个错误提示与上一个问题类似,也是OpenGL库抛出的错误,错误码为1282,对应的错误描述是"invalid operation", 即无效操作。具体原因可能与调用的OpenGL函数、OpenGL上下文的状态等有关。需要检查调用OpenGL函数的参数是否正确,以及OpenGL上下文是否正确初始化。如果有更多的上下文信息,可以提供给我,我可以帮你分析更详细的原因。
相关问题
for external in metadata.entry_points().get(self.group, []): Traceback (most recent call last): File "D:/Desktop/deepLearn/policy-gradient-tensoflow2.0-master/策略梯度_算法原生实现.py", line 4, in <module> import gym File "D:\DevTools\Anaconda3-5.2.0\envs\tf2\lib\site-packages\gym\__init__.py", line 13, in <module> from gym.envs import make, spec, register File "D:\DevTools\Anaconda3-5.2.0\envs\tf2\lib\site-packages\gym\envs\__init__.py", line 10, in <module> _load_env_plugins() File "D:\DevTools\Anaconda3-5.2.0\envs\tf2\lib\site-packages\gym\envs\registration.py", line 269, in load_env_plugins context = contextlib.nullcontext() AttributeError: module 'contextlib' has no attribute 'nullcontext'
这个错误是因为您的 Python 版本太低,`contextlib.nullcontext` 函数在 Python 3.6 及以下版本中不存在。
解决方法是升级您的 Python 版本至 Python 3.7 或以上版本。如果您无法升级 Python 版本,也可以手动添加 `nullcontext` 函数定义,如下:
```python
import contextlib
if not hasattr(contextlib, 'nullcontext'):
class nullcontext(contextlib.AbstractContextManager):
def __init__(self, enter_result=None):
self.enter_result = enter_result
def __enter__(self):
return self.enter_result
def __exit__(self, *excinfo):
pass
contextlib.nullcontext = nullcontext
```
添加了上述代码后,您的代码应该就可以正常运行了。
in some cases result in small but subtle issues and is discouraged. import numpy as np Traceback (most recent call last): File "D:/Desktop/dql/a.py", line 1, in <module> import gym File "D:\DevTools\Anaconda3-5.2.0\envs\dql\lib\site-packages\gym\__init__.py", line 13, in <module> from gym.envs import make, spec, register File "D:\DevTools\Anaconda3-5.2.0\envs\dql\lib\site-packages\gym\envs\__init__.py", line 10, in <module> _load_env_plugins() File "D:\DevTools\Anaconda3-5.2.0\envs\dql\lib\site-packages\gym\envs\registration.py", line 250, in load_env_plugins for plugin in metadata.entry_points().get(entry_point, []): AttributeError: 'EntryPoints' object has no attribute 'get'
Based on the error message, it seems that there is an issue with the gym package in your Python environment. The error message suggests that there is a problem with an 'EntryPoints' object not having the 'get' attribute. This may be caused by a version incompatibility or a missing dependency.
You can try to resolve this issue by updating the gym package and any dependencies it may have. You can do this by running the following command in your terminal:
```
pip install --upgrade gym
```
If this does not work, you can also try to uninstall and then reinstall the gym package:
```
pip uninstall gym
pip install gym
```
If neither of these solutions work, you may need to investigate further or seek help from the gym community.
阅读全文