目前DeepMind已经在Debian和Ubuntu两个Linux系统上测试了OpenSpiel,具体安装方法如下:
git clone https://github.com/deepmind/open_spiel.git
cd open_spiel
./install.sh # Install various dependencies (note: assumes Debian-based distro!)
pip3 install --upgrade -r requirements.txt # Install Python dependencies
mkdir build
cd build
# Note: Python version installed should be >= Python_TARGET_VERSION specified here
CXX=g++ cmake -DPython_TARGET_VERSION=3.6 -DCMAKE_CXX_COMPILER=g++ ../open_spiel
make -j12 # The 12 here is the number of parallel processes used to build
ctest -j12 # Run the tests to verify that the installation succeeded
需要注意的是install.sh中安装依赖项的命令是基于Ubuntu的,如果使用的是其他Linux发行版,依赖项仍然可用,但安装命令需根据情况自行修改。
为了能够从任何位置导入Python代码,需要将根目录和open_spiel目录添加到PYTHONPATH。使用virtualenv时,应添加路径/bin/activate。
# For the python modules in open_spiel.
export PYTHONPATH=$PYTHONPATH:/<path_to_open_spiel>
# For the Python bindings of Pyspiel
export PYTHONPATH=$PYTHONPATH:/<path_to_open_spiel>/build/python
然后你就可以运行自己的第一个游戏了!
examples/example --game=tic_tac_toe 27名作者、豪华阵容背景