简体   繁体   English

如何在 Pycharm 上运行 Pygame

[英]How do I run Pygame on Pycharm

I am trying to run pygame on the PyCharm IDE, I have installed the latest version of pygame for python 3.5 and have added it to the project interpreter.我正在尝试在 PyCharm IDE 上运行 pygame,我已经为 python 3.5 安装了最新版本的 pygame 并将其添加到项目解释器中。 I installed pygame from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame and copied it too python35-32/Scripts/ .我从http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame安装了 pygame 并且也复制了它python35-32/Scripts/ The test program below runs fine in the python shell but I want to run it from PyCharm.下面的测试程序在 python shell 运行良好,但我想从 PyCharm 运行它。

I have been trying to solve this for the past hour and I've hit a wall.在过去的一个小时里,我一直在努力解决这个问题,但我碰壁了。 When I run this simple test program to see if pygame is working:当我运行这个简单的测试程序以查看 pygame 是否正常工作时:

import pygame

pygame.init()
pygame.display.set_mode((800, 800))

I get this error:我收到此错误:

Traceback (most recent call last): 
  File "C:/Users/jerem/PycharmProjects/Games/hello_pygame.py", line 1, in <module>
    import pygame
  File "C:\Users\jerem\AppData\Roaming\Python\Python35\site-packages\pygame\__init__.py", line 141, in <module>
    from pygame.base import *
ImportError: No module named 'pygame.base'

Any help would be greatly appreiciated, Thanks again, JC任何帮助将不胜感激,再次感谢,JC

Follow the instructions provided here. 按照此处提供的说明操作。 I think its related to the problem you are having on pygame and PyCharm on windows. 我认为它与你在Windows上的pygame和PyCharm上遇到的问题有关。 How do I download Pygame for Python 3.5.1? 如何下载Pygame for Python 3.5.1?

its bcus pycharme has not recognised you're env or working on wrong env它的 bcus pycharme 没有识别出你是 env 或在错误的 env 上工作这是它的样子

https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html check this https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html检查这个

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

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