[英]Import "pygame" could not be resolved
我在命令提示符下使用 pip 安裝了 pygame 但它仍然顯示錯誤。 我已經嘗試更改路徑,以便可以正確訪問 pip 並使用“pygame.init()”行,但錯誤仍然出現。
這是代碼:
import pygame, sys
pygame.init()
w, h = 600, 600
r = (255, 0, 0)
s = pygame.display.set_mode( (w, h) )
s.fill(r)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pygame.display.update()
順便說一下,如果它仍然無法正常工作,您可以嘗試使用 Pycharm。如果您不能這樣做,您可以嘗試使用 replit 並下載 pygame package,然后使用 Github 將其導出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.