• Python _tkinter问题解决办法


    _tkinter

    this article introduce how to solve the problem"ImportError: No module named _tkinter"

    When we use "import Tkinter" in python2.7+ or use "import tkinter" in python 3.0+,most people could meet this problem "ImportError: No module named _tkinter",But how to solve?

    First: Install Tkinter

    In console,we can use this command: sudo apt-get install python-tk //if you use python2.7+ Or sudo apt-get install python3-tk //if you use python3.0+

    Then: Install tcl and tk

    DownloadAddress:http://www.tcl.tk/software/tcltk/download.html

    download package: tcl8.7a1-src.tar.gz & tk8.7a1-src.tar.gz

    (1) install tcl8.7a1-src.tar.gz:   
           $:tar -xzvf tcl8.6.1-src.tar.gz
           $:cd tcl8.7a1/unix/
           $:./configure
           $:make
           $:sudo make install
           
    (2) install tk8.7a1-src.tar.gz:
           $:tar -xzvf tk8.7a1-src.tar.gz
           $:cd tk8.7a1/unix/
           $:./configure
           $:make
           $:sudo make install
      when you make you would meet this mistake:"No such file or directory",you can do this to sure you install success:
           $:sudo apt-get install libx11-dev
           $:sudo make install
      when you use 
           $:wish  
           $:info tclversion  
      you can see the tk_version,and then you neet install the general lib 
           $:sudo apt-get install autoconf curl libmysqld-dev libaio-dev libjpeg62-dev libpng12-dev libfreetype6-dev libssl-dev zlib1g-dev
           $:sudo apt-get install  libbz2-dev libgdbm-dev  
           $:sudo apt-get install sqlite3 libsqlite3-tcl libsqlite3-dev  
           $:sudo apt-get install  python-bsddb3  
           
       (3) Sure your python can use "import tkinter":
           $:python
           $:import Tkinter(this command only used in python 2.7+,if your python version latter than python3.0,you need use "import tkinter"
        if the console No pop-up message,it means you install _tkinter successful,while the console Appear Popup Message,
        you can run command again:
           $:sudo apt-get install python-tk
  • 相关阅读:
    神经网络层数问题
    matlab入门笔记(六):编程基础之M文件
    工字电感,色环电感,功率电感选型区别
    x电容和Y电容
    nohup.out文件过大解决方法 定时任务清空
    WebRTC的视频解码原理简析
    activemq 安装 部署
    WebRTC信令控制简介与STUN, TURN服务器搭建
    如何搭建WebRTC信令服务器
    ZooKeeper安装和配置
  • 原文地址:https://www.cnblogs.com/Calainkey/p/10509847.html
Copyright © 2020-2023  润新知