I cannnot add Tkinter to package list
已回答
- I am using LINUX UBUNTU and tried everything so the Tkinter module appear in the list of packages but it does not work.
I have: - Installed directly on Linux using apt-get install
- tried adding the directory to manage repositories
Nothing works. I can use the basics with the TkBasic package available but it is not the original package
请先登录再写评论。
Hello,
Have you added your system python as project interpreter to Pycharm(https://www.jetbrains.com/help/pycharm/2017.1/configuring-local-python-interpreters.html)? If so, Tkinter should appear in the packages list in Settings| Project| Project interpreter.
I am using windows 7 64 bit with Python 64 bit. I am having the same issue. Tkinter isn't available. I have already set Python as my interpreter. I've also looked for Tkinter under the "Available Packages" by selecting the green "plus" button. I see several items, but none are Tkinter. Any help would be much appreciated.
HI Levipack! Could you please clarify what do you mean by "isn't available"? tkinter is in the standard Python library, so you don't need to install it.
I knew that! Just joking... I didn't know that! Boy, do I feel whatever the exact opposite of really smart is.
Thanks!!!
Hi, Folks!
I have the same problem: my Pycharm Comminity Version 2018.3 doesn't see tkinter module.
When running it pops out with the error.
Hi Pythontarium,
How does it go if you run your script outside of PyCharm (e.g. from the system terminal) using the same interpreter? Does the same error appear?
When I open the terminal and type:
python3 (press enter)
from tkinter import *
root = Tk() (press enter)
It works and the window appears.
When I do the same thing in the pycharm ide, it give me an error.
ModuleNotFoundError: No module named 'tkinter'
I try to edit configurations and switch between interpreters, but it makes no difference. I try to install python3-tk and python3-tkinter and tkinter in the terminal, but I get the message that these modules are already installed.
@Tomandsusan4ever
What you need to do is to ensure that you're using the same interpreter and environment in PyCharm that you were using in the terminal where it was working.
Try the following:
1. In your system terminal, run `python3 -m tkinter` . Tkinter sample window should pop up indicating tkinter is installed and working
2. Open your PyCharm project, open the terminal, check your python version first with `python -V`, ensure it's python 3, and then do the same - `python -m tkinter`
If you get the error here, you're using different interpreter with no tkinter installed.
@Andrey Reslner
I followed those instruction: I got the sample window when I entered 'python3 -m tkinter' in terminal. When I entered python -V in the pycharm terminal, I got 'Python 2.7.15'. I've gone to Run> Edit Configurations > Python interpreter and selected a version of Python 3. I've even added python interpreters by going to FIle > Settings > Project Interpreter and then adding to the list of interpreters. I have several Python 3 files which I select as interpreters, but none of them work and I still get the 'Python 2.7.15' in the terminal regardless of what ever I select.
Then, the problem is that your project is using python 2.x, not 3.x
Try to delete and recreate the interpreter. Provide screenshots of each step of the process, so I could understand where is the issue in your configuration.
Make sure you're following the documentation: https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html
(I suggest creating a new virtualenv based on python 3.x)
@Andrey Resler
I've gone to File > Setting > Project Interpeter > (gear icon) > Add... > Virtualenv Environment. From there I can not delete any interpreters unless I navigate to the files where the python files are and delete them . I tried that once when I was having problems with Ubuntu and it totally screwed many of the programs in Ubuntu. It is my understanding that many programs in Linux run on python. When I enter the screen, python 3.7 is shown as the base interpreter. I select a different versions of python under the New Environment section, but whatever I pick, the OK button is inactive. I can select Existing Environment and navigate to versions of 3.7 such as the one in usr/bin. I apply the changes but it doesn't change the python -V in pycharm's terminal.
Under > System Interpreter I don't get an option for a 3 or 3.7. I can press the ... icon and navigate to one. Then I apply the changes, but the python -V in pycharm's terminal still reads 2.7.
Sorry I can't include screenshots. For some reason I can't access jetbrains forums with modzilla on my virtual machine.
>navigate to versions of 3.7 such as the one in usr/bin
This is a global system interpreter and should be configured as system interpreter, not virtual environment.
Try this:
1. Open interpreter list and delete ALL interpreters
2. Confirm that you have python3 interpreter in your system. Try `python -V` or `python3 -V`
2. Restart PyCharm, start a new project > Pure python > new virtual env > Select Python 3.7 as base interpreter, click OK
Which step produces and error? Please provide screenshot of the error (I seen that you have issues with screenshots, but otherwise your problem is very confusing and I can't understand it just using my imagination, unfortunately)
Well, I did have success with this. In PyCharm I went to File > Settings > Project: > Project Interpreter > click the drop down menu on the Project Interpreter > Show All... > (press '-' to delete all interpreters from the drop down menu. Then I quit and restarted the program. Then File > New Project > Then created new project. From there I went to File > Settings > Project: > Project Interpreter and selected Python 3.7. Now when I open the terminal in pycharm (located at the bottom of the pycharm window) and type python -V. I get the response Python 3.7.2.
Now I'm having a hard time getting tkinter installed.... I was able to install openpyxl an Pillow using "pip install openpyxl" in the terminal in pycharm, but "pip install tkinter" returns the error "Could not find a version that satisfies the requirement tkinter (from versions: ) No matching distribution found for tkinter." You did answer the orignal question though. Any further help would be appreciated.
@Jiri Fait
That is the case with python for windows. That is not the case with python for linux. I've tried many many times.
Well, this is more of a python question.
Please try methods described here:
https://stackoverflow.com/questions/4783810/install-tkinter-for-python
http://www.greenteapress.com/thinkpython/swampy/install.html
Hi.. I am new to python and I am using intellij as my ide in my windows 10 OS I searched in Google for how should I install tkinter in intellij but I am not getting any results.. can u pls help ?
Shruti28052002
Please see our documentation https://www.jetbrains.com/help/idea/installing-uninstalling-and-upgrading-packages.html