yyt
yyt

Reputation: 111

Can't import gym; ModuleNotFoundError: No module named 'gym'

enter image description here

Can't import gym;

ModuleNotFoundError: No module named 'gym'

Upvotes: 11

Views: 69912

Answers (5)

ruxtain
ruxtain

Reputation: 194

First run this:

pip install gym

Then run your import gym again.

Upvotes: 2

Chandan
Chandan

Reputation: 540

As you are using Anaconda as your package manager, use this to install gym

conda install -c conda-forge gym

Upvotes: 1

Rajesh Jha
Rajesh Jha

Reputation: 1

this works for me to hope its work for you also!!

pip install --user gym

Upvotes: 0

pradyunsg
pradyunsg

Reputation: 19486

It seems to me that you're trying to use https://pypi.org/p/gym.

You'd want to run in the terminal (before typing python, when the $ prompt is visible):

pip install gym

After that, if you run python, you should be able to run import gym.

Upvotes: 8

user9008857
user9008857

Reputation:

I see that you're installing gym, so

pip install gym 

is unnecessary.

Please, try:

import sys
sys.path.append('path')

where path is directory with gym module.

Upvotes: 4

Related Questions