gpt4 book ai didi

python - OpenAI Gym - AttributeError : module 'contextlib' has no attribute 'nullcontext'

转载 作者:行者123 更新时间:2023-12-04 14:02:37 33 4
gpt4 key购买 nike

尝试从 docker 运行命令时,我遇到了这个错误 google 计算引擎上的 docker 容器。
这是堆栈跟踪:

Traceback (most recent call last):
File "train.py", line 16, in <module>
from stable_baselines.ppo1 import PPO1
File "/home/selfplay/.local/lib/python3.6/site-packages/stable_baselines/__init__.py", line 3, in <module>
from stable_baselines.a2c import A2C
File "/home/selfplay/.local/lib/python3.6/site-packages/stable_baselines/a2c/__init__.py", line 1, in <module>
from stable_baselines.a2c.a2c import A2C
File "/home/selfplay/.local/lib/python3.6/site-packages/stable_baselines/a2c/a2c.py", line 3, in <module>
import gym
File "/home/selfplay/.local/lib/python3.6/site-packages/gym/__init__.py", line 13, in <module>
from gym.envs import make, spec, register
File "/home/selfplay/.local/lib/python3.6/site-packages/gym/envs/__init__.py", line 10, in <module>
_load_env_plugins()
File "/home/selfplay/.local/lib/python3.6/site-packages/gym/envs/registration.py", line 269, in load_env_plugins
context = contextlib.nullcontext()
AttributeError: module 'contextlib' has no attribute 'nullcontext'

最佳答案

这似乎是python 3.6和gym的问题。将我的容器升级到 python 3.7 解决了这个问题。

关于python - OpenAI Gym - AttributeError : module 'contextlib' has no attribute 'nullcontext' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69520829/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com