Qiita Conference 2025

ミノ駆動 (@MinoDriven)

プロフェッショナルとしての成長──「問題の深掘り」が導く真のスキルアップ

2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ModuleNotFoundError: No module named '_tkinter' の時の対処法

Posted at

macOSを使っている著者が、tkinterを使って遊ぼうと思った時に、タイトルのエラーにでくわしました。
めっちゃ簡潔に、このエラーを解決した手順を記しておきます。

$ brew install tcl-tk
(中略)

でインストールしたtinkerについて、以下のエラーが出ました。

$ python3
Python 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>import tkinter
(中略)
ModuleNotFoundError: No module named '_tkinter'

調べたところ、よくあるバージョンの食い違いエラーだったみたいです。
具体的にはPythonとtkinterとのバージョンの食い違いです。

$ python3 --version
Python 3.12.2

このPythonに合わせたtkinterをインストールします。

$ brew install python-tk@3.12.2

これで解決しました。

あんまり意義のない記事かと思いますが、質より量かと思って残しておきます。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?