我成功安装了tkinter但是当我在pycharm中运行我的程序时仍然出现错误。如果我从终端运行它,它工作正常。
我收到此错误:
ModuleNotFoundError:没有名为'tkinter'的模块
我有一种感觉,我必须以某种方式告诉我的Pycharm虚拟环境,它需要包含tkinter。这在设置 - >项目解释器中不可用。
我在Linux Mint btw,我使用python3.7。
如果您使用的是虚拟环境,则需要找到相应虚拟环境的Python位置,然后使用source
命令激活虚拟环境。
# active virtualenv
source virtualenv_path/bin/activate