简体   繁体   English

Pip安装后无法导入Pygame

[英]Unable To Import Pygame After Pip Install

I installed pygame through pip. 我通过pip安装了pygame。 I know for a fact it is there, as I have seen the file labeled 'pygame' in the file explorer. 我知道它在那里,因为我在文件浏览器中看到了标有“ pygame”的文件。 However Python does not agree with me that it is certainly there. 但是Python与我不同意它确实存在。

What makes this odd is that i've installed pygame using pip before on a different user, it worked fine, and i did nothing differently this time. 奇怪的是,我之前使用pip在其他用户上安装了pygame,效果很好,这次我没有做任何不同的事情。

import pygame Traceback (most recent call last): File "", line 1, in import pygame ModuleNotFoundError: No module named 'pygame' 导入pygame追溯(最近一次调用):导入pygame中文件“”,第1行,ModuleNotFoundError:没有名为“ pygame”的模块

Check your virtual environment. 检查您的虚拟环境。 It seems that you are not using the environment where you have installed pygame. 似乎您未使用安装pygame的环境。 If you are using Anaconda, the environment is specified in parentheses. 如果使用Anaconda,则在括号中指定环境。 You can activate your environment using: conda activate <conda environment name here> 您可以使用以下方法激活环境: conda activate <conda environment name here>

Hope this works! 希望这有效!

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

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