In this blog, I will set up a virtual environment using pip, It is always better to make a virtual environment in order to perform some machine learning or reinforcement learning or any other task which depends upon different library version. You can also create a virtual environment using Anaconda but in this blog, I will go with the virtual environment created using pip. The rest of the steps will be the same.
The first thing you have to do is to install the package that will be used to create the virtual environment
pip install virtualenv
Next is to create a virtual environment using pip with the following command:
virtualenv striker source ./striker/bin/activate
Now the virtual environment is activated. Next, install important libraries to run the retro.
pip install tensorflow pip install retro
Next run the Airstriker-Genesis game with the sample actions.
import retro
def main():
env = retro.make(game='Airstriker-Genesis')
obs = env.reset()
while True:
obs, rew, done, info = env.step(env.action_space.sample())
env.render()
if done:
obs = env.reset()
env.close()
if __name__ == "__main__":
main()
When you run this code you will get this error.
Read More »