gpt4 book ai didi

没有为 Tk 配置 Python

转载 作者:IT老高 更新时间:2023-10-28 21:08:09 26 4
gpt4 key购买 nike

我正在使用 pyenv 使用 Ubuntu 13.10 和 Python 3.3.4。我使用其他模块没有问题。当我进入 python 控制台并写入时

import tkinter

输出

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serdar/.pyenv/versions/3.3.4/lib/python3.3/tkinter/__init__.py", line 40, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'

我已经安装了 python3-tktk-devel

最佳答案

您需要在 pyenv install 期间提供 Tk 开发文件/头文件。

在 Ubuntu (15.04) 上应提供以下内容:sudo apt-get install tk-dev.

在此之后,pyenv install 3.4.3(或 pyenv install 2.7.10 等)应该会选择它并支持 Tk。

( Reference issue in pyenv )

关于没有为 Tk 配置 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22550068/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com