在Python安装中包括Tkinter?

时间:2018-02-28 17:22:11

标签: python tkinter installation

我在Ubuntu 16.04上运行Python 2.7.14并且很难包括Tkinter。

以下是我收到的一些消息:

make

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _tkinter           bsddb185        
dbm                dl                 gdbm            
imageop            readline           sunaudiodev     
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

我试着查看setup.py,但根本无法理解我在做什么。

我通过终端安装了tk和tcl:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
tk is already the newest version (8.6.0+9).
0 upgraded, 0 newly installed, 0 to remove and 300 not upgraded.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
tcl is already the newest version (8.6.0+9).
0 upgraded, 0 newly installed, 0 to remove and 300 not upgraded.

来自https://wiki.python.org/moin/TkInter

"如果"没有名为Tkinter"的模块失败,则需要更改Python配置以在其默认模块搜索路径中包含包含Tkinter.py的目录。您可能忘记在Modules / Setup文件中定义TKPATH。临时解决方法是找到该目录并将其添加到PYTHONPATH环境变量中。它是名为" lib-tk"的子目录。 Python库目录(使用Python 1.4或更早版本时,它被命名为" tkinter")。"

我有点理解该做什么但不知道怎么做。有人有主意吗?感谢。

编辑:这个问题与virtualenv无关,而是与Tkinter在本地安装Python。

0 个答案:

没有答案