如何解决创建从 github 安装的健身房时出现 ModuleNotFoundError
我试图为 Kaggle hungry geese competition 创建一个自定义健身房。我创建了一个并提交了 here。我用命令安装它:
pip install git+https://github.com/Mahesha999/gym-hungrygeese.git
然后尝试创建一个健身房:
import gym
env = gym.make('gym_hungrygeese:hungrygeese-v0')
但它给出了以下错误:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py in spec(self,path)
108 try:
--> 109 importlib.import_module(mod_name)
110 # catch ImportError for python2.7 compatibility
7 frames
/usr/lib/python3.7/importlib/__init__.py in import_module(name,package)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:],package,level)
128
/usr/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name,level)
/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name,import_)
/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name,import_)
ModuleNotFoundError: No module named 'gym_hungrygeese'
During handling of the above exception,another exception occurred:
Error Traceback (most recent call last)
<ipython-input-17-8fba512a2b25> in <module>()
1 import gym
----> 2 env = gym.make('gym_hungrygeese:hungrygeese-v0')
/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py in make(id,**kwargs)
143
144 def make(id,**kwargs):
--> 145 return registry.make(id,**kwargs)
146
147 def spec(id):
/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py in make(self,path,**kwargs)
87 else:
88 logger.info('Making new env: %s',path)
---> 89 spec = self.spec(path)
90 env = spec.make(**kwargs)
91 # We used to have people override _reset/_step rather than
/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py in spec(self,path)
110 # catch ImportError for python2.7 compatibility
111 except ImportError:
--> 112 raise error.Error('A module ({}) was specified for the environment but was not found,make sure the package is installed with `pip install` before calling `gym.make()`'.format(mod_name))
113 else:
114 id = path
Error: A module (gym_hungrygeese) was specified for the environment but was not found,make sure the package is installed with `pip install` before calling `gym.make(
)`
我缺少什么?
PS:您可以找到 colab 笔记本 here。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。