python3000怎么安装tkinter

软件和网站开发以及相关技术探讨
回复
头像
sammysun
帖子: 4088
注册时间: 2007-12-08 23:33
来自: SCUT-guangzhou

python3000怎么安装tkinter

#1

帖子 sammysun » 2009-03-06 22:22

我电脑上同时装了python2,和python3,我从新德里里面安装了tkinter,但是好像只有python2里面能import Tkinter,而python3里面不能调用此模块,请问怎么才能让python3里面也能用!
谢谢 :em03
soiamso
帖子: 418
注册时间: 2008-09-06 2:00

Re: python3000怎么安装tkinter

#2

帖子 soiamso » 2009-03-07 14:02

头像
sammysun
帖子: 4088
注册时间: 2007-12-08 23:33
来自: SCUT-guangzhou

Re: python3000怎么安装tkinter

#3

帖子 sammysun » 2009-03-08 10:13

soiamso 写了:注意大小写

http://docs.python.org/3.0/library/tkinter.html
兄弟,我还是没找到怎么安装到python3000的办法,能详细告知吗?非常感谢!! :em03
头像
sammysun
帖子: 4088
注册时间: 2007-12-08 23:33
来自: SCUT-guangzhou

Re: python3000怎么安装tkinter

#4

帖子 sammysun » 2009-03-08 10:25

我发现一个问题,当我运行python3.0时不能够 import tkinter,当运行python3时又能够import tkinter,请问是怎么回事?

代码: 全选

sammy@sammy-desktop:~$ python3.0
Python 3.0.1 (r301:69556, Feb 23 2009, 15:13:35) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.0/tkinter/__init__.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Tkinter
>>> 
sammy@sammy-desktop:~$ python3
Python 3.0rc1+ (py3k, Oct 28 2008, 09:23:29) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> 
soiamso
帖子: 418
注册时间: 2008-09-06 2:00

Re: python3000怎么安装tkinter

#5

帖子 soiamso » 2009-03-10 13:36

代码: 全选

If this fails your Python may not be configured for Tk
第一个python 应该是在编译的时候没有选上对 Tk 的支持,或缺少 共享库文件(.so 或 .pyd)。

代码: 全选

import _tkinter

从 前面的 "_" 可以知道他需要加载 共享库文件 那个文件的名字叫 tkinter.so 或 tkinter.pyd

应该可以用 python 中 easyinstall 等方法进行补救。
回复