简体   繁体   English

Tkinter在树莓派bash中

[英]Tkinter in raspberry pi bash

I am able to import tkinter in idle3 and used it to create a simple application and in Idle3 everything works great. 我能够在idle3中导入tkinter并使用它来创建一个简单的应用程序,并且在Idle3中一切正常。 The problem is, if I try to start the program from bash, I get the error: 问题是,如果我尝试从bash启动程序,则会收到错误消息:

ImportError: No module named 'tkinter.filedialog'; 'tkinter is not a package

Why would the pi be able to run a program in idle3 but not when start with 为什么pi能够在idle3中运行程序,而在启动时却不能

python3 program.py

It seems to be that idle3 recognizes the tkinter package but my bash cannot. 似乎是idle3可以识别tkinter软件包,但是我的bash不能。 Any Solutions? 有解决方案吗?

The only thing I can think of is that it's being run with python instead of python3 我唯一能想到的是它正在使用python而不是python3运行

Make sure the shebang line is #!/usr/bin/env python3 确保shebang行是#!/usr/bin/env python3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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