创建从 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 (将#修改为@)