λ python draw.py
Traceback (most recent call last):
File "draw.py", line 4, in <module>
turtle.width(4)
File "<string>", line 6, in width
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3812, in init
Turtle._screen = Screen()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3662, in Screen
Turtle._screen = _Screen()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3678, in init
_Screen._root = self._root = Root()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 434, in init
TK.Tk. init (self)
File "C:\\Program Files\\Python37\\lib\\tkinter_ init .py", line 2023, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can\'t find a usable tk.tcl in the following directories:
C:/Program Files/Python37/lib/tcl8.6/tk8.6 C:/Program Files/Python37/lib/tk8.6 C:/Program Files/lib/tk8.6 C:/Program Files/lib/tk8.6 C:/lib/tk8.6 C:/Program Files/library
λ python draw.py
Traceback (most recent call last):
File "draw.py", line 4, in <module>
turtle.width(4)
File "<string>", line 6, in width
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3812, in init
Turtle._screen = Screen()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3662, in Screen
Turtle._screen = _Screen()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 3678, in init
_Screen._root = self._root = Root()
File "C:\\Program Files\\Python37\\lib\\turtle.py", line 434, in init
TK.Tk. init (self)
File "C:\\Program Files\\Python37\\lib\\tkinter_ init .py", line 2023, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can\'t find a usable init.tcl in the following directories:
C:\\Program Files (x86)\\CSR\\BlueSuite 2.6.9 C:/Program Files/Python37/lib/tcl8.6 C:/Program Files/lib/tcl8.6 C:/lib/tcl8.6 C:/Program Files/library C:/library C:/tcl8.6.9/library C:/tcl8.6.9/library
将tk8.6和tcl8.6复制到C:\\Program Files\\Python37\\Lib下即可解决。
具体原因未知
找到原因