0

I use Enthought Canopy as my Python 3 environment, and I recently got a new-to-me Windows machine. Having switched from Mac, I started from scratch as far as all my modules go in Canopy. I've been messing with GUIs lately, and when I got on my new machine to start a little app, I try to import tkinter but got this traceback:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-b98d59735c04> in <module>()
----> 1 import tkinter

C:\Users\User\AppData\Local\Enthought\Canopy\edm\envs\User\lib\tkinter\__init__.py in <module>()
     33 import sys
     34 
---> 35 import _tkinter # If this fails your Python may not be configured for Tk
     36 TclError = _tkinter.TclError
     37 from tkinter.constants import *
ImportError: DLL load failed: The specified module could not be found. 

What perplexes me is that there is a tkinter folder where the rest of my Canopy modules are, and the error is actually coming from __init__.py

The pudding is really on line 35 of that __init__ file where it says "if this fails your Python may not be configured for Tk". Iirc, my Mac setup of Canopy already had Tkinter, or it was in Canopy's package manager, making installation really quick and painless. It is not in Canopy's package manager, in any of the Canopy repositories.

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
Breh
  • 1
  • 1
  • Possible duplicate? https://stackoverflow.com/questions/5459444/tkinter-python-may-not-be-configured-for-tk – Cory Madden Jul 19 '17 at 02:48
  • @cory Not quite; that poster was having a similar problem, but on Linux. None of those solutions are applicable to my situation. I can't quite figure out how to add packages to Canopy that aren't in Canopy's repositories. On my Mac, a pip install or a sudo made everything really easy, however, I'm not familiar with Windows command line, and everything I do in it seems to fail... – Breh Jul 21 '17 at 17:30
  • Ah, sorry I can't help. I ditched Windows years ago. :) – Cory Madden Jul 21 '17 at 17:33
  • I found this page: http://www.tkdocs.com/tutorial/install.html that sounds like it relates to your issue. Unfortunately it doesn't provide much information other than you possibly had errors when you originally compiled Python. Did you compile it yourself? Did you try reinstalling Python? – Cory Madden Jul 21 '17 at 17:35
  • Does this answer your question? [Why does tkinter (or turtle) seem to be missing or broken? Shouldn't it be part of the standard library?](https://stackoverflow.com/questions/76105218/why-does-tkinter-or-turtle-seem-to-be-missing-or-broken-shouldnt-it-be-part) – Karl Knechtel Apr 30 '23 at 00:20

0 Answers0