简体   繁体   English

为什么进口健身房不起作用; 但是,命令 pip install gym 已完成并执行

[英]Why doesn't import gym work; however, the command pip install gym was done and executed

I have went to the terminal and used,"pip install gym", and it successfully installed gym.我去了终端并使用了“pip install gym”,它成功地安装了 gym。 When I go to use the, "import gym," command, I get an error when running the code at that line.当我 go 使用“导入健身房”命令时,在该行运行代码时出现错误。

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."我看过其他帖子,他们都说破坏后应该可以工作,“pip install gym”。 Although mine successfully installed, it still doesn't work.我的虽然安装成功了,但是还是不行。

You need to verify that you are using the same version of python that you did pip install with.您需要验证您使用的 python 版本与pip install pip 时使用的版本相同。 In VS Code, you can select the Python version in the upper right corner.在 VS Code 中,您可以在右上角输入 select Python 版本。 Simply type "python --version" into the console to verify the version.只需在控制台中输入“python --version”即可验证版本。 You might want to use Anaconda because someone libraries like Tensorflow only fully-support Anaconda.您可能想使用 Anaconda,因为像 Tensorflow 这样的库仅完全支持 Anaconda。

if you have pip installed it, there is no way that it will not work.如果你有 pip 安装它,它不可能不工作。 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.或者您在系统上安装了不同版本的 python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM