目的:安装Unity的一个插件ML_Agent
操作系统:win10
参考链接: https://github.com/Unity-Technologies/ml-agents/blob/0.10.0/docs/Installation-Windows.md.
ML_Agent的版本:0.10.0
Unity版本:2017.4.13
注:之所以未选择Unity及ML_Agent的最新版本,是由于我自己课题的需要。
以下介绍详细步骤。
步骤1:安装anaconda
由于我的笔记本上在很久之前就已经安装anaconda。在此就不再做详细记录。
步骤2:在anaconda 中重建所需的虚拟环境
打开 Anaconda Prompt,输入以下指令:
conda create -n ml-agents python=3.6
在安装过程中出现无法定位程序输入点OPENSSL_sk_new_reserve……的问题,该问题的解决方案参考链接: https://blog.csdn.net/qq_37465638/article/details/100071259.
选择y/yes创建完成之后,输入以下指令
activate ml-agents
现在的界面如下所示:
接下来安装tensorflow1.7.1版本,该版本的ML_Agent不支持tensorflow更高的版本。直接在Anaconda Prompt,输入以下指令:
pip install tensorflow==1.7.1
出现以下安装失败提示:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.7.1
换源重试指令如下:
pip install tensorflow==1.7.1 -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com
安装tensorflow成功
步骤3:安装所需要的python包
(1)安装git
已经在windows中安装过git的可以跳过。
安装参考链接: https://blog.csdn.net/qq_40837206/article/details/100559914.
由于GIT官网打不开,我在链接: https://gitforwindows.org/中下载的。
(2)安装python相关的包
打开链接: https://github.com/Unity-Technologies/ml-agents/tree/0.10.0. 直接下载。我下载到了C:\Users\MI下。
在ml-agents虚拟环境下,输入如下指令:
git clone https://github.com/Unity-Technologies/ml-agents.git
下载完成之后,为了下载指定版本0.10.0,运行指令
pip install mlagents==0.10.0
我下载这个的时候下载速度超级慢,多次下载失败。
哈哈,换源就很快了!可以将指令修改为
pip --default-timeout=1000 install mlagents==0.10.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
在 Anaconda Prompt中打开 C:\Users\MI\ml-agents-0.10.0,即
cd C:\Users\MI\ml-agents-0.10.0
然后依次输入指令:
cd ml-agents-envs
pip install -e .
cd ..
cd ml-agents
pip install -e .
部分操作界面如下所示:
步骤4:下载GUP版本的tensorflow(可选)
这一步我没有做,到此就可以使用ml-agents了。