Ubuntu 上的 TK_LIBRARY 和 TCL_LIBRARY 环境变量 [英] TK_LIBRARY and TCL_LIBRARY environment variables on Ubuntu

查看:46
本文介绍了Ubuntu 上的 TK_LIBRARY 和 TCL_LIBRARY 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 _tkinter 导入 Python.我怀疑这可能是因为没有为环境变量 TK_LIBRARY 和 TCL_LIBRARY 定义值.这是将 apt-get 用于 python-tk、tcl 和 tk 后的状态.如果我必须手动设置环境变量,我会将它们设置为什么?

I'm trying to get _tkinter to import into Python. I suspect it may be due to not having values defined for the environment variables TK_LIBRARY and TCL_LIBRARY. This is as it stands after using apt-get for python-tk, tcl, and tk. If I have to set the environment variables manually, what would I set them to?

我使用的是 Ubuntu 10.10 和 Python 2.5.5.

I am using Ubuntu 10.10 and Python 2.5.5.

推荐答案

不需要,不需要设置 TK_LIBRARY 和 TCL_LIBRARY.我怀疑您正在调用与 /usr/bin/python 不同的 Python 解释器,或者 /usr/bin/python 已更改为指向与一个与 python-tk 包一起使用的.Ubuntu 10.10 默认附带 Python 2.6.

No, setting TK_LIBRARY and TCL_LIBRARY should not be necessary. I suspect you are invoking a Python interpreter different from /usr/bin/python, or /usr/bin/python has been changed to point to a different Python interpreter than the one that goes with the python-tk package. Ubuntu 10.10 ships with Python 2.6 by default.

编辑:要构建支持 Tk 的 Python 2.5,请确保在运行 configure 之前安装了 tk-dev 包.还要检查构建输出的末尾还有哪些模块没有构建,并考虑安装相关的头文件.确保您的安装不会覆盖/usr/bin/python,例如通过安装到/usr/local(这是配置的默认设置).

Edit: To build Python 2.5 with Tk support, make sure the tk-dev package is installed before running configure. Also check the end of the build output what other modules have not been built, and consider installation the relevant header files. Make sure that your installation does not overwrite /usr/bin/python, e.g. by installing into /usr/local (which is the default for configure).

这篇关于Ubuntu 上的 TK_LIBRARY 和 TCL_LIBRARY 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆