[英]How to use tkinter in Pycharm virtualenv?
I installed tkinter succesfully but I still get an error when I run my program in pycharm.我成功安装了 tkinter,但是在 pycharm 中运行我的程序时仍然出现错误。 It works fine if I run it from terminal.
如果我从终端运行它,它工作正常。
I get this error:我收到此错误:
ModuleNotFoundError: No module named 'tkinter' ModuleNotFoundError: 没有名为“tkinter”的模块
I have a feeling I have to somehow tell my Pycharm virtual environment that it needs to include tkinter.我有一种感觉,我必须以某种方式告诉我的 Pycharm 虚拟环境它需要包含 tkinter。 This is not available in settings --> project interpreter.
这在设置 --> 项目解释器中不可用。
I am on Linux Mint btw, and I use python3.7.顺便说一句,我在 Linux Mint 上,我使用 python3.7。
If you are using a virtual environment, you need to find the Python location of the corresponding virtual environment, then use the source
command to activate the virtual environment.如果使用的是虚拟环境,则需要找到对应虚拟环境的Python位置,然后使用
source
命令激活虚拟环境。
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000639400-Activating-virtual-environment-in-Pycharm-python-console https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000639400-Activating-virtual-environment-in-Pycharm-python-console
# active virtualenv
source virtualenv_path/bin/activate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.