Hands-On Intelligent Agents with OpenAI Gym
上QQ阅读APP看书,第一时间看更新

Creating the conda environment

Now that we have set up Anaconda, let's use conda to create a Python virtual environment, which we will use throughout this book.

If you prefer a one-click install setup and do not want to go through the installation step by step, a greatly simplified way to create the environment with all the necessary packages installed is using the conda_env.yaml conda environment configuration file available in the book's code repository. You can simply run the following command from the book's code repository directory ( HOIAWOG) which we created in the previous section:
praveen@ubuntu:~/HOIAWOG$ conda create -f conda_env.yaml -n rl_gym_book

At this point, we will just create a new minimal environment to proceed. Enter the following command in a Terminal:

praveen@ubuntu:~$conda create --name rl_gym_book python=3.5

This will create a conda environment named rl_gym_book with a Python3 interpreter. It will print some information about what is going to be downloaded and the packages that will be installed. You may be prompted with a yes/no question as to whether you want to proceed. Type y and hit Enter. Once the environment creation process is complete, you can activate that environment using the following command:

praveen@ubuntu:~$source activate rl_gym_book

You will now see your command prompt's prefix changing to look something like this, to signify that you are inside the rl_gym_book virtual environment:

(rl_gym_book) praveen@ubuntu:~$

You can use this as an indicator as you progress through the chapters to know when commands have to be entered inside this environment and when commands can be entered outside the environment. To exit or deactivate the environment, you can simply type this:

praveen@ubuntu:~$source deactivate