You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Google Colab中运行MarsExplorer(OpenAI Gym环境)导入失败求助

解决MarsExplorer导入失败的方法

1. 添加仓库路径到Python环境

克隆仓库后,Python默认不会自动识别该仓库的模块路径,需要手动添加:

import sys
from pathlib import Path

# 替换为你实际的克隆路径,通常Colab里是/content/MarsExplorer
repo_path = Path("/content/MarsExplorer")
sys.path.append(str(repo_path))

# 可执行此命令验证路径是否添加成功
print("当前Python搜索路径:", sys.path)

2. 安装项目依赖

项目可能存在未安装的依赖包,进入仓库目录安装所需依赖:

cd /content/MarsExplorer
pip install -r requirements.txt

3. 核对导入语句的正确性

确保导入语句与项目示例一致,避免拼写错误或路径错误:

# 基础导入方式
import mars_explorer
# 或按项目示例的类导入
from mars_explorer import MarsExplorer

4. 重启Colab运行时(若以上步骤无效)

点击顶部菜单栏的Runtime -> Restart runtime,之后重新执行克隆、路径添加、依赖安装及导入代码,清除运行时缓存问题。


内容的提问来源于stack exchange,提问作者kwasi_dp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.26 01:15:36