[英]Python dictionary inside __init__() does not appear covered after running coverage.py in PyCharm
[英]GUI does not appear when running python code with VSCode and Pycharm
我试图编写一些 python 代码,在我的代码中我导入了海龟模块,当我在 VSCode 上运行我的代码时,我希望看到一个 GUI window 但我得到了以下错误:
除此之外,我还收到了 Python 的问题报告:
这就是我的代码的样子:
import turtle
my_turtle = turtle.Turtle()
my_turtle.shape("turtle")
my_turtle.color("red")
my_turtle.forward(100)
screen = turtle.Screen()
screen.exitonclick()
我的 macOS 版本是 11.1 顺便说一句。
如果我错了,请纠正我,但显然 Python 2.7.16 不支持 Turtle 模块,所以我在终端上将 python 版本切换到 3.9.1,当我运行python main.py
时终于出现了。
我使用以下命令在终端上切换 python 版本:
alias python="python3"
虽然我已经在我的终端上解决了这个问题,但我还没有看到在 VSCode 上更改 python 版本的方法。
也许您应该将 python 3.9.1 直接安装到您的机器中,这样您就不用担心了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.