python - Python 初学者

标签 python python-3.x command

我对Python相当陌生,因为我正在自学,我遇到了一些最小的错误,学生们大多会问他们的教授,但我现在没有能力这样做,所以我在这里。 我想检查我的 PC 上是否使用命令安装了 Tkinter,但我收到语法错误消息,有人可以帮助我吗? 我输入 -> python -m tkinter

--------------------------------
>> python -m tkinter
  File "<stdin>", line 1
    python -m tkinter
                    ^
SyntaxError: invalid syntax

最佳答案

如果您想快速了解一句,您可以从任何命令行运行以下命令:

python -c“导入 tkinter”

如果模块不存在,它将输出错误;如果模块存在,则不输出任何内容。例如,我可以看到这个:

$ python -c "import tkinter"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named tkinter
$ python -c "import array"
$

关于python - Python 初学者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54026854/

相关文章:

command - 将带有空格的路径作为参数传递给bat文件

python - 如何在 immut 中使用相同的键获取所有值。听写?

python-3.x - 使用部署的 Azure 函数从 Blob 存储下载文件非常慢

c# - 如何在远程计算机上执行命令?

Python 3 : Output R, G,B 到 CSV - 索引错误:图像索引超出范围

python - Kivy-python : duplicate image on texture

Java Runtime.getRunTime().exec(CMD) 不支持管道

python - 使用 Azure Batch 中的托管标识在批处理池中使用 Python 通过 Key Vault 进行身份验证

Python:绝对路径问题

python - 将 csv 文件发送到 fastAPI 并取回新文件