python - 创建从 github 安装的健身房时出现 ModuleNotFoundError
问题描述
我正在尝试为Kaggle 饥饿的鹅比赛创建一个定制的健身房。我创建了一个并在这里提交。我用命令安装它:
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, package, 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 notebook 。
解决方案
推荐阅读
- c# - Charts X Value seems to shift to the right
- android - 如何接受颤振医生的执照?
- javascript - 如何在没有再次运行命令的情况下使用 webpack-dev-server 自动重建包?
- excel - Worksheet.UsedRange.Rows.Count 返回错误结果
- jquery - DataTables 按名称访问列或从服务器返回额外数据
- android - android设备上的jquery ui自动完成autoFocus
- lambda - 如何在 groupingBy 后排序并选择排序列表中的第一个元素
- python - 为什么我在不释放密钥的情况下获得 Pygame KEYUP 事件?
- python - Python龙卷风使用带参数的继承
- c# - WPF背景依赖两个参数