Home > Software design >  Why doesn't import gym work; however, the command pip install gym was done and executed
Why doesn't import gym work; however, the command pip install gym was done and executed

Time:01-30

I have went to the terminal and used,"pip install gym", and it successfully installed gym . When I go to use the, "import gym," command, I get an error when running the code at that line.

Exception has occurred: ModuleNotFoundError
No module named 'gym'

I have looked at other posts and they all say it should work after ruining,"pip install gym." Although mine successfully installed, it still doesn't work.

CodePudding user response:

You need to verify that you are using the same version of python that you did pip install with. In VS Code, you can select the Python version in the upper right corner. Simply type "python --version" into the console to verify the version. You might want to use Anaconda because someone libraries like Tensorflow only fully-support Anaconda.

CodePudding user response:

if you have pip installed it, there is no way that it will not work. Unless you've installed it to a virtual environment and running your program without it and vice versa. Or you've installed to a different version of python on your system.

  • Related