## guided policy search代码在pycharm中调试的mjcpy激活的坑
world = mjcpy.MJCWorld(model_path)
ERROR: Could not open activation key file src/3rdparty/mjpro/mjkey.txtPress Enter to exit …
在terminal中尝试
成功案例!
失败案例!
pycharm中尝试
失败案例
问题的根本原因
working directory的不同,导致了问题的公共和失败,在
cbfinn/gps
中的目录结构简单如下:
tree -L 2
# 显示如下目录,省略了大部分不要的
.
├── compile_proto.sh
├── docs
├── experiments
├── Guided Policy Search — GPS 0.1 documentation_files
├── LICENSE
├── mjc_models
├── python
│ ├── gps
│ ├── __init__.py
│ └── tests
├── README.md
├── src
└── vrep_models
pycharm打开最外层的gps文件夹,包含所有如上的目录,在对
path_to_gps/gps/python/gps/gps_main.py
调试的时候,工作目录是
path_to_gps/gps/python/gps/gps_main.py
,而激活mujoco mjckey.txt所要的工作目录是
path_to_gps/gps/
,结合原始教程中的示例:
cd path_to_gps/gps/
python python/gps/gps_main.py mjc_mdgps_example
pycharm中的修改
将working directory修改到正确的工作目录就行了
terminal中的测试代码
# python==2.7.15
import mjcpy
import sys
path = "path_to_gps/gps/python/"
sys.path.append(path)
model_path = "path_to_gps/gps/mjc_models/pr2_arm3d.xml"
world = mjcpy.MJCWorld(model_path)
print world
版权声明:本文为qq_41009742原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。