0

Recently, I installed pypy3.6 on my computer. I tried to run tkinter like this:

Python 3.6.9 (1608da62bfc7, Dec 23 2019, 12:38:24)
[PyPy 7.3.0 with MSC v.1911 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import tkinter
>>>> root = tkinter.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\pypy3.6\lib-python\3\tkinter\__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
  File "D:\pypy3.6\lib_pypy\_tkinter\__init__.py", line 31, in create
    interactive, wantobjects, wantTk, sync, use)
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 157, in __new__
    Tcl_AppInit(self)
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 49, in Tcl_AppInit
    app.raiseTclError()
  File "D:\pypy3.6\lib_pypy\_tkinter\app.py", line 171, in raiseTclError
    tklib.Tcl_GetStringResult(self.interp)).decode('utf-8'))
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    D:/pypy3.6/lib_pypy/lib/tcl8.5 D:/lib/tcl8.5 D:/lib/tcl8.5 D:/library D:/library D:/tcl8.5.2/library D:/tcl8.5.2/library

This probably means that Tcl wasn't installed properly.

My Environment Variable(part) Environment Variable For Pypy3

When I tried on my CPython 3.8.1, it worked well.

martineau
  • 119,623
  • 25
  • 170
  • 301
Andy Zhou
  • 152
  • 1
  • 10

1 Answers1

2

I think the d:\pypy3.6\tcl\tcl8.5 library should be renamed to d:\pypy3.6\lib\tcl and d:\pypy3.6\tcl\tk8.5 renamed to d:\pypy3.6\lib\tk. If you do that does it solve the problem?

This was an issue with the pypy zipfile. It was fixed and will be part of the next release.

mattip
  • 2,360
  • 1
  • 13
  • 13
  • Relocating tcl & tk directories also solved it for me. Does anybody know why those directories are not placed at the right location on installation? – Robert_Jordan Jun 18 '20 at 07:06