解决Windows中Python使用Tkinter出现”_tkinter.TclError: Can’t find a usable tk.tcl”错误

目录

  • 一、问题描述
  • 二、解决方案
  • 一、问题描述

    Windows下使用python中的tkinter时出现的一个奇怪的问题,之前写的代码明明没有问题,更新python版本之后,结果再使用tkinter时报错:“Tcl lnit error: Can’t find a usable init.tcl in the following directories”

    当前的系统和python版本:

  • 操作系统:win10
  • python版本:3.10
  • 二、解决方案

    原因:系统查找的库目录不对,默认查找D:\Programs\python310\Lib,其中,D:\Programs\python310是你的Python安装路径

    image-20230724085302898

    方法:将D:\Programs\python310\tcl下的tcl8.6文件夹复制拷贝到D:\Programs\python310\Lib文件夹中

    image-20230724084613330

    物联沃分享整理
    物联沃-IOTWORD物联网 » 解决Windows中Python使用Tkinter出现”_tkinter.TclError: Can’t find a usable tk.tcl”错误

    发表评论