简体   繁体   中英

How can I open pygame windows outside of PyCharm?

I made a game in pygame. It works perfectly fine when run from pycharm. However, when I want to run it from another location, say command prompt or just windows explorer, all that I get is a black screen that briefly pops up before closing.

I have had the same problems when writing code that uses selenium or other imports. I'm quite sure that the imports are the problem. Code without imports works just fine, regardless from where it's run.

I'm sorry if this is a stupid question with an obvious answer, I'm still a beginner. Thank you in advance, noble people of StackOverflow.

Try to run this command in cmd (outside the environment):

pip install pygame 

Mine works fine and, yes, it is a problem related to the imports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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