win10安装maddpg

系统环境

win10、Anaconda3-5.3.1-Windows-x86_64、python3.7.0

第一步,安装tensorflow

  1. 在Anaconda Prompt中输入:conda create -n tensorflow
  2. 在Anaconda Prompt中输入:activate tensorflow
  3. 安装CPU版本tensorflow:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
  4. 安装过程中的错误:
  • 错误1:Cannot uninstall wrapt,解决方案:pip install wrapt --ignore-installed
  • 错误2:twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.解决方案:pip install PyHamcrest
  1. 安装后出现错误:ImportError DLL load failed,Failed to load the native TensorFlow runtime.此时安装 Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 即可正常使用。
  2. 测试:命令行下输入python,再输入import tensorflow,没有错误提示即可。
  3. 查看tensorflow版本,在Anaconda Prompt中输入:pip show tensorflow
  4. anaconda查看环境,在Anaconda Prompt中输入:conda info --envs

第二步,下载MADDPGMPE

1.解压缩maddpg-master.zip和multiagent-particle-envs-master.zip
2.在maddpg-master文件夹外层目录运行命令pip install -e maddpg-master
3.在multiagent-particle-envs-master文件夹外层目录运行命令pip install -e multiagent-particle-envs-master
4.设置系统环境变量,把multiagent-particle-envs-master所在路径加入系统path中
4.在maddpg的experiments文件夹中运行:python train.py --scenario simple时出错:ImportError: cannot import name ‘prng’ from ‘gym.spaces’。这是gym版本问题,解决方案:pip install gym==0.10.5
5.又出现错误:ModuleNotFoundError: No module named ‘tensorflow.contrib’,解决方案pip install tensorflow==1.14.0
[没注意看,maddpg依赖的环境是: Python (3.5.4), OpenAI gym (0.10.5), tensorflow (1.8.0), numpy (1.14.5),走了很多弯路。其他没有改,gym改为了0.10.5,tensorflow改为了1.14.0]
6.训练结束,写文件时又出错了:

Traceback (most recent call last):
File “train.py”, line 193, in
train(arglist)
File “train.py”, line 182, in train
rew_file_name = arglist.plots_dir + arglist.exp_name + ‘_rewards.pkl’
TypeError: can only concatenate str (not “NoneType”) to str

解决方案:修改train.py第182行为rew_file_name = str(arglist.plots_dir) + str(arglist.exp_name) + '_rewards.pkl'
第185行为agrew_file_name = str(arglist.plots_dir) + str(arglist.exp_name) + '_agrewards.pkl'

成功!
在这里插入图片描述

想要显示图形界面,修改train.py第32行为parser.add_argument("--display", action="store_true", default=True)
在这里插入图片描述

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值