如何在visual studio代码中导入pygame? [英] How to import pygame in visual studio code?

查看:171
本文介绍了如何在visual studio代码中导入pygame?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual Studio 代码进行编码 (python),现在我必须为我的项目编写一个带有 pygame 的程序,而且我无法在 Visual Studio 代码中import pygame(我可以用python脚本导入它,只是不能在visual studio代码中imported).

I use visual studio code for coding (python) and now I have to write a program with pygame for my project and I can't import pygame in visual studio code (I can import it with the python script, it just can't be imported in visual studio code).

推荐答案

这是我尝试过的解决方案:

Here is the solution I tried:

从你的 vs 代码的左下角你可以找到 python 环境,你可以在我标记为红色的图像中:

From left bottom of your vs code you can find python environment, you can in the image I marked red:

点击红色标记区域后,您可以看到以下选项供您选择:

after clicking in the red marked area you can see below option to select:

从选项中选择您想要的.假设首先我尝试选择第二个但它不起作用然后我尝试了最后一个并且它起作用了.

from the option select your desired one. Suppose first i was try selecting 2nd one but it was not working then i tried with the last one and it worked.

这篇关于如何在visual studio代码中导入pygame?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆