(py37) parkgyeongtae-2:1_cartpole-v1-example pgt0409$ python 0_cartpole-v1-example.py
Traceback (most recent call last):
File "0_cartpole-v1-example.py", line 3, in <module>
env = gym.make('CartPole-v1')
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/registration.py", line 676, in make
return registry.make(id, **kwargs)
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/registration.py", line 520, in make
return spec.make(**kwargs)
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/registration.py", line 139, in make
cls = load(self.entry_point)
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/registration.py", line 55, in load
mod = importlib.import_module(mod_name)
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
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 "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/classic_control/__init__.py", line 1, in <module>
from gym.envs.classic_control.cartpole import CartPoleEnv
File "/Users/pgt0409/opt/anaconda3/envs/py37/lib/python3.7/site-packages/gym/envs/classic_control/cartpole.py", line 10, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
pip install pygame
(py37) parkgyeongtae-2:1_cartpole-v1-example pgt0409$ pip install pygame
Collecting pygame
Using cached pygame-2.1.2-cp37-cp37m-macosx_10_9_x86_64.whl (8.9 MB)
Installing collected packages: pygame
Successfully installed pygame-2.1.2
python 0_cartpole-v1-example.py
import gym
env = gym.make('CartPole-v1')
env.reset()
for i in range(500):
env.render()
env.step(env.action_space.sample())
env.close()
'Programming Language > Python' 카테고리의 다른 글
[Python] CartPole-v1, 강화학습 행동을 막대 기울기에 의존해보기 (0) | 2022.04.28 |
---|---|
[Python] CartPole-v1, 강화학습 행동을 랜덤으로 실행해보기 (0) | 2022.04.28 |
[Python] No module named 'gym' 해결방법 (0) | 2022.04.23 |
[Python] 강화학습, CartPole-v1 기울기값에 따른 행동 변화 (0) | 2022.04.23 |
[Python] 강화학습 예제, CartPole-v1 같은 행동 10번 반복 할 때 관찰값 (0) | 2022.04.22 |