本文共 1012 字,大约阅读时间需要 3 分钟。
1.创建anaconda环境:
conda create -n openspiel python=3.7
2 激活环境:
source activate openspiel
3.更新
sudo apt-get update
4.安装matplotlib
conda install matplotlib
matplotlib版本至少3.11,默认安装就是这个版本
5.安装cmake
conda install cmake
cmake版本至少3.12,默认安装3.14
6.下载编译安装openspiel
git clone https://github.com/deepmind/open_spiel.gitcd open_spiel./install.sh # Install various dependencies (note: assumes Debian-based distro!)pip3 install --upgrade -r requirements.txt # Install Python dependenciesmkdir buildcd buildCXX=g++ cmake -DPython_TARGET_VERSION=3.6 -DCMAKE_CXX_COMPILER=g++ ../open_spielmake -j6ctest -j6
7. 把pythonpath加入bashrc
sudo gedit .bashrc
在最下面加入:
# For the Python modules in open_spiel.export PYTHONPATH=$PYTHONPATH:/# For the Python bindings of Pyspielexport PYTHONPATH=$PYTHONPATH:/ /build/python
更新一下bashrc
source .bashrc
8.安装absl-py
pip install absl-py
9.跑测试试一下:
cd openspiel/openspielpython3 python/examples/example.py --game=breakthroughpython3 python/examples/matrix_game_example.py
10.参考资料:
转载地址:http://nnisn.baihongyu.com/