Tkinter not found in pycharm - python

I want to use the tkinter module and PyCharm is making it difficult. I am using the Python 3.7 Interpreter, and I have not been able to use it.
I have tried a few things:
pip install tkinter
pip3 install tkinter
sudo apt install tkinter
sudo apt install python-tk
None of these have success
Whenever I use import tkinter, it just returns the error
Traceback (most recent call last):
File "/home/removed/PycharmProjects/Tutorials/GUI.py", line 1, in <module>
import tkinter
ModuleNotFoundError: No module named 'tkinter'
Process finished with exit code 1
Anyone know of a solution?

Always make sure you have the right interpreter selected;
In PyCharm, you can check this by pressing ctrl + alt + s, and navigating to the "project interpreter" tab. Here you can select the different python installations on your system.

This thread might be a little old but I had the same problem for the past 3 days. My solution was as follows (btw I'm running Linux Mint 19 Cinnamon with python3.x):
-Remove PyCharm (I had installed it via Linux Mint's software center)
-Download PyCharm from the JetBrains website.
the "tkinter" module was by installed and recognized by default.

Related

ModuleNotFoundError: No module named 'tkinter' / PyCharm

I am trying to run this code in pycharm:
import tkinter as tk
root = tk.Tk()
w = tk.Label(root, text="Hello, world!")
w.pack()
root.mainloop()
However it always gives me the following errror:
Traceback (most recent call last):
File "/home/nils/PycharmProjects/rfid/first_test.py", line 1, in <module>
import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
If I use the same exact code in IDLE, it works perfectly. I just can not figure out how to install/import tkitner (through the project interpreter didnt work). I am using python 3.7 and the newest Linux Mint.
If you could provide me some hints or a solution, it would be very much appreciated :D
Thanks!
Edit: Typing in " import tkinter " in the IDLE shell works fine, however typing in the same in the PyCharm console produces the error above...
Edit2: I solved the problem by completly uninstalling pycharm and installing it again.
If you're here and have issues on macOS Big Sur, and use Homebrew know that tkinter is not included with Python 3.9, and needs to be installed separately.
brew install python-tk#3.9
You can right click it and go to context actions to install or go to the terminal and type,
pip install python-tkinter or sudo apt install python-tkinter!

Python IDLE seems to be unable to import Pyperclip in python 36?

I am trying to import the thing in python that will enable me to copy and past things. It seems to have a problem. I later searched my entire C drive for pyperclip and it seems to be not have it at all. How can I go about fixing this? Or am I not looking in the right area? Here is the error:
import pyperclip
Traceback (most recent call last):
File "", line 1, in
import pyperclip
ModuleNotFoundError: No module named 'pyperclip'
BTW I'm on windows 10
You seems a new learner for Python. You can try to install that package via pip command. For other problem like how to use pip or which user to run pip, just go to search and solve it by yourself.
So yes you're right. You need to open up cmd prompt. use the cd to change the directory to the one inside Python36\Scripts. Then run the command
pip install pyperclip

Import requests working on Windows shell but not in PyCharm

The simple import of requests
import requests
can be executes and used in windows shell but the same code says in pycharm:
Traceback (most recent call last):
File "C:/Users/XPS13/PycharmProjects/Testing/Webcrawler_Test.py", line 1, in
<module>
import requests
ModuleNotFoundError: No module named 'requests'
requests was correctly pip installed. Even uninstalling and reinstalling doesn't work.
Any help would be appreciated.
Yeah so this might be a little late but I fixed my problem like this:
Go to Settings/Preferences
Select Project Interpreter
And press the + button on the left side
That + sign
Search for requests
And press Install Package
I am running:
Windows 10
Python 3.7.1
You need to configure the project interpreter in PyCharm:
Go to Settings/Preferences
Select Project Interpreter
Click the little gear and click Add...
Select the appropriate interpreter (whether a virtual environment or system python installation)
Settings top right
'+' above Package table
Search: Requests & highlight in list
Install Package

Python 3.5.0b3, 3.5.0rc1: How to make tkinter, Idle, and turtle work on Windows

I have a problem with Python installation on Win 7 Pro.
Python 3.5a2 installs without any problems and work ok.
Python 3.5rc1 installs without any problems but idle doesn't work.
The some was with 3.5b3.
Do you have any idea?
This a a bug in recent 3.5.0 Windows installers.
Symptom: Install 3.5.0rc1 (for instance) on Windows machines without VS2015 installed. Run interactive python and enter import tkinter or run a program that does so (Idle, Turtle, turtledemo, or your own). Get message
Your Python may not be configured for Tk.
Fix: In python35 install directory, find subdirectory /DLLs. In that find subdirectory /MicrosoftVC140.CRT with one file vcruntime140.dll. Move this file up into /DLLs (leaving /MicrosoftVC140.CRT empty). Tkinter should now work.

ezyang / git-ftp on Windows

I have been trying to install git-ftp from https://github.com/ezyang/git-ftp on my windows. I know most of git-ftp need cygwin or just cant be install on windows but, since its coded in Python and you can install a Python interpreter on windows, i tough i could install it.
I installed Python 3.2, added it to my path. Then i pulled the lastest version of git-ftp and followed the install instructions which are pretty clear :
Requirements: [git-python 3.x] ( http://gitorious.org/git-python )
it can be installed with `easy_install gitpython`
Usage: `python git-ftp.py`
Then i run 'python git-ftp.py' and i get the following error :
python git-ftp.py install
File "git-ftp.py", line 322
print complaint
^
SynthaxError: invalid synthax
My question is : why dosent it work? is it a python error, git-ftp script error, windows compatibility issues?
Note : I didint installed 'easy_install gitpython', do i absolutly need it?
Edit :
I also tried to install python-2.7.2.amd64-pdb and runned the same command and i get an other error :
python git-ftp.py install
Traceback (most recent call last):
File "git-ftp.py", line 48, in <module>
from git import Tree, Blob, Repo, Git, Submodule
ImportError : No module named git
I Belive it is beacause the script cant find my git or something like that, I then tried to put the correct 'ftpdata' file in a .git folder and runned the script from the root folder of the .git and even tried to run it from the .git folder itself. That didint work either.
I dont know if it matters but i have a Windows 7 - 64 bit (Intel Core2 Duo CPU T9600)
My question is : how to tell the python script where's the git module?
git-ftp is written Python 2, and is not, as it stands, compatible with Python 3. Install an earlier version of the interpreter.
Edit. You need to install the git-python library. Since the easiest way to install libraries is easy_install, you should set it up with the instructions here: http://pypi.python.org/pypi/setuptools and then run easy_install git-python.

Categories

Resources